Adding support for mass. (#2301)

* Adding support for mass.

* update grpc v1.69.2

* Upgrade protos using latest protoc

* Use MassCommitment instead of Mass

* Fix DomainTransaction clone, equal and tests

---------

Co-authored-by: veronica <jimjouny@gmail.com>
Co-authored-by: Ori Newman <orinewman1@gmail.com>
This commit is contained in:
Veronica 2025-01-21 16:57:28 +08:00 committed by GitHub
parent 6085d1fc84
commit 43b9523919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 4019 additions and 6673 deletions

View File

@ -2,9 +2,10 @@ package appmessage
import ( import (
"encoding/hex" "encoding/hex"
"github.com/pkg/errors"
"math/big" "math/big"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/domain/consensus/utils/blockheader" "github.com/kaspanet/kaspad/domain/consensus/utils/blockheader"
"github.com/kaspanet/kaspad/domain/consensus/utils/hashes" "github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
"github.com/kaspanet/kaspad/domain/consensus/utils/utxo" "github.com/kaspanet/kaspad/domain/consensus/utils/utxo"
@ -213,13 +214,14 @@ func RPCTransactionToDomainTransaction(rpcTransaction *RPCTransaction) (*externa
} }
return &externalapi.DomainTransaction{ return &externalapi.DomainTransaction{
Version: rpcTransaction.Version, Version: rpcTransaction.Version,
Inputs: inputs, Inputs: inputs,
Outputs: outputs, Outputs: outputs,
LockTime: rpcTransaction.LockTime, LockTime: rpcTransaction.LockTime,
SubnetworkID: *subnetworkID, SubnetworkID: *subnetworkID,
Gas: rpcTransaction.Gas, Gas: rpcTransaction.Gas,
Payload: payload, MassCommitment: rpcTransaction.Mass,
Payload: payload,
}, nil }, nil
} }
@ -287,6 +289,7 @@ func DomainTransactionToRPCTransaction(transaction *externalapi.DomainTransactio
LockTime: transaction.LockTime, LockTime: transaction.LockTime,
SubnetworkID: subnetworkID, SubnetworkID: subnetworkID,
Gas: transaction.Gas, Gas: transaction.Gas,
Mass: transaction.MassCommitment,
Payload: payload, Payload: payload,
} }
} }

View File

@ -52,6 +52,7 @@ type RPCTransaction struct {
SubnetworkID string SubnetworkID string
Gas uint64 Gas uint64
Payload string Payload string
Mass uint64
VerboseData *RPCTransactionVerboseData VerboseData *RPCTransactionVerboseData
} }

View File

@ -329,6 +329,7 @@ func initTestBlockAcceptanceDataForClone() []*externalapi.BlockAcceptanceData {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -377,6 +378,7 @@ func iniBlockAcceptanceDataForEqual() []testBlockAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -410,6 +412,7 @@ func iniBlockAcceptanceDataForEqual() []testBlockAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -443,6 +446,7 @@ func iniBlockAcceptanceDataForEqual() []testBlockAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -476,6 +480,7 @@ func iniBlockAcceptanceDataForEqual() []testBlockAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -510,6 +515,7 @@ func iniBlockAcceptanceDataForEqual() []testBlockAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -614,6 +620,7 @@ func initTestAcceptanceDataForClone() []externalapi.AcceptanceData {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -664,6 +671,7 @@ func initAcceptanceDataForEqual() []testAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -697,6 +705,7 @@ func initAcceptanceDataForEqual() []testAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -730,6 +739,7 @@ func initAcceptanceDataForEqual() []testAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -763,6 +773,7 @@ func initAcceptanceDataForEqual() []testAcceptanceDataStruct {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{ externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -18,8 +18,9 @@ type DomainTransaction struct {
Gas uint64 Gas uint64
Payload []byte Payload []byte
Fee uint64 Fee uint64
Mass uint64 Mass uint64
MassCommitment uint64
// ID is a field that is used to cache the transaction ID. // ID is a field that is used to cache the transaction ID.
// Always use consensushashing.TransactionID instead of accessing this field directly // Always use consensushashing.TransactionID instead of accessing this field directly
@ -47,23 +48,24 @@ func (tx *DomainTransaction) Clone() *DomainTransaction {
} }
return &DomainTransaction{ return &DomainTransaction{
Version: tx.Version, Version: tx.Version,
Inputs: inputsClone, Inputs: inputsClone,
Outputs: outputsClone, Outputs: outputsClone,
LockTime: tx.LockTime, LockTime: tx.LockTime,
SubnetworkID: *tx.SubnetworkID.Clone(), SubnetworkID: *tx.SubnetworkID.Clone(),
Gas: tx.Gas, Gas: tx.Gas,
Payload: payloadClone, Payload: payloadClone,
Fee: tx.Fee, Fee: tx.Fee,
Mass: tx.Mass, Mass: tx.Mass,
ID: idClone, MassCommitment: tx.MassCommitment,
ID: idClone,
} }
} }
// If this doesn't compile, it means the type definition has been changed, so it's // If this doesn't compile, it means the type definition has been changed, so it's
// an indication to update Equal and Clone accordingly. // an indication to update Equal and Clone accordingly.
var _ = DomainTransaction{0, []*DomainTransactionInput{}, []*DomainTransactionOutput{}, 0, var _ = DomainTransaction{0, []*DomainTransactionInput{}, []*DomainTransactionOutput{}, 0,
DomainSubnetworkID{}, 0, []byte{}, 0, 0, DomainSubnetworkID{}, 0, []byte{}, 0, 0, 0,
&DomainTransactionID{}} &DomainTransactionID{}}
// Equal returns whether tx equals to other // Equal returns whether tx equals to other
@ -112,6 +114,10 @@ func (tx *DomainTransaction) Equal(other *DomainTransaction) bool {
return false return false
} }
if tx.MassCommitment != other.MassCommitment {
return false
}
if tx.Fee != 0 && other.Fee != 0 && tx.Fee != other.Fee { if tx.Fee != 0 && other.Fee != 0 && tx.Fee != other.Fee {
panic(errors.New("identical transactions should always have the same fee")) panic(errors.New("identical transactions should always have the same fee"))
} }

View File

@ -83,6 +83,7 @@ func initTestBaseTransaction() *externalapi.DomainTransaction {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -112,6 +113,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -137,6 +139,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -162,6 +165,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01, 0x02}, //Changed []byte{0x01, 0x02}, //Changed
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -186,6 +190,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -213,6 +218,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -239,6 +245,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
1000000000, //Changed 1000000000, //Changed
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -263,6 +270,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -287,6 +295,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
2, //Changed 2, //Changed
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -311,6 +320,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -341,6 +351,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -366,6 +377,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -390,6 +402,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
nil, //changed nil, //changed
}, },
expectedResult: true, expectedResult: true,
@ -411,6 +424,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -435,6 +449,7 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -461,6 +476,34 @@ func initTestTransactionToCompare() []*transactionToCompare {
[]byte{0x01}, []byte{0x01},
0, 0,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}),
},
expectedResult: false,
},
{
tx: &externalapi.DomainTransaction{
1,
[]*externalapi.DomainTransactionInput{{externalapi.DomainOutpoint{
*externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x01}), 0xFFFF},
[]byte{1, 2, 3},
uint64(0xFFFFFFFF),
1,
utxo.NewUTXOEntry(1, &externalapi.ScriptPublicKey{Script: []byte{0, 1, 2, 3}, Version: 0}, true, 2)}},
[]*externalapi.DomainTransactionOutput{{uint64(0xFFFF),
&externalapi.ScriptPublicKey{Script: []byte{1, 2}, Version: 0}},
{uint64(0xFFFF),
&externalapi.ScriptPublicKey{Script: []byte{1, 3}, Version: 0}}},
1,
externalapi.DomainSubnetworkID{0x01},
1,
[]byte{0x01},
0,
1,
1, // Changed
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -536,6 +579,7 @@ func initTestDomainTransactionForEqual() []testDomainTransactionStruct {
[]byte{0x01}, []byte{0x01},
1, 1,
1, 1,
0,
externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, externalapi.NewDomainTransactionIDFromByteArray(&[externalapi.DomainHashSize]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -555,6 +599,7 @@ func initTestDomainTransactionForEqual() []testDomainTransactionStruct {
[]byte{0x01}, []byte{0x01},
1, 1,
1, 1,
0,
nil, nil,
}, },
expectedResult: false, expectedResult: false,
@ -569,6 +614,7 @@ func initTestDomainTransactionForEqual() []testDomainTransactionStruct {
[]byte{0x01}, []byte{0x01},
1, 1,
1, 1,
0,
nil, nil,
}, },
expectedResult: true, expectedResult: true,
@ -583,6 +629,7 @@ func initTestDomainTransactionForEqual() []testDomainTransactionStruct {
[]byte{0x01}, []byte{0x01},
2, // Changed fee 2, // Changed fee
1, 1,
0,
nil, nil,
}, },
expectsPanic: true, expectsPanic: true,

View File

@ -27,7 +27,7 @@ func TransactionHash(tx *externalapi.DomainTransaction) *externalapi.DomainHash
// Encode the header and hash everything prior to the number of // Encode the header and hash everything prior to the number of
// transactions. // transactions.
writer := hashes.NewTransactionHashWriter() writer := hashes.NewTransactionHashWriter()
err := serializeTransaction(writer, tx, txEncodingFull) err := serializeTransaction(writer, tx, txEncodingFull, true)
if err != nil { if err != nil {
// It seems like this could only happen if the writer returned an error. // It seems like this could only happen if the writer returned an error.
// and this writer should never return an error (no allocations or possible failures) // and this writer should never return an error (no allocations or possible failures)
@ -52,7 +52,7 @@ func TransactionID(tx *externalapi.DomainTransaction) *externalapi.DomainTransac
encodingFlags = txEncodingExcludeSignatureScript encodingFlags = txEncodingExcludeSignatureScript
} }
writer := hashes.NewTransactionIDWriter() writer := hashes.NewTransactionIDWriter()
err := serializeTransaction(writer, tx, encodingFlags) err := serializeTransaction(writer, tx, encodingFlags, false)
if err != nil { if err != nil {
// this writer never return errors (no allocations or possible failures) so errors can only come from validity checks, // this writer never return errors (no allocations or possible failures) so errors can only come from validity checks,
// and we assume we never construct malformed transactions. // and we assume we never construct malformed transactions.
@ -74,7 +74,7 @@ func TransactionIDs(txs []*externalapi.DomainTransaction) []*externalapi.DomainT
return txIDs return txIDs
} }
func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodingFlags txEncoding) error { func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodingFlags txEncoding, includeMass bool) error {
err := binaryserializer.PutUint16(w, tx.Version) err := binaryserializer.PutUint16(w, tx.Version)
if err != nil { if err != nil {
return err return err
@ -126,6 +126,15 @@ func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodi
return err return err
} }
if includeMass {
if tx.MassCommitment > 0 { // For backward compatibility, serialize MassCommitment only if it's not zero
err = binaryserializer.PutUint64(w, tx.Mass)
if err != nil {
return err
}
}
}
return nil return nil
} }

17
go.mod
View File

@ -8,7 +8,7 @@ require (
github.com/btcsuite/winsvc v1.0.0 github.com/btcsuite/winsvc v1.0.0
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.1
github.com/gofrs/flock v0.8.1 github.com/gofrs/flock v0.8.1
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.4
github.com/jessevdk/go-flags v1.4.0 github.com/jessevdk/go-flags v1.4.0
github.com/jrick/logrotate v1.0.0 github.com/jrick/logrotate v1.0.0
github.com/kaspanet/go-muhash v0.0.4 github.com/kaspanet/go-muhash v0.0.4
@ -16,18 +16,17 @@ require (
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d
github.com/tyler-smith/go-bip39 v1.1.0 github.com/tyler-smith/go-bip39 v1.1.0
golang.org/x/crypto v0.1.0 golang.org/x/crypto v0.28.0
golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd golang.org/x/term v0.25.0
golang.org/x/term v0.5.0 google.golang.org/grpc v1.69.2
google.golang.org/grpc v1.38.0 google.golang.org/protobuf v1.35.1
google.golang.org/protobuf v1.28.1
) )
require ( require (
github.com/golang/snappy v0.0.1 // indirect github.com/golang/snappy v0.0.1 // indirect
golang.org/x/net v0.7.0 // indirect golang.org/x/net v0.30.0 // indirect
golang.org/x/sys v0.5.0 // indirect golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.7.0 // indirect golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08 // indirect google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect
) )

52
go.sum
View File

@ -26,6 +26,10 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@ -40,8 +44,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@ -49,9 +54,12 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@ -80,17 +88,25 @@ github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJ
github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=
github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd h1:zVFyTKZN/Q7mNRWSs1GOYnHM9NiFSJ54YVRsD0rNWT4=
golang.org/x/exp v0.0.0-20220414153411-bcd21879b8fd/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@ -106,8 +122,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -121,16 +137,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
@ -142,7 +158,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@ -155,8 +170,9 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU=
google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@ -168,8 +184,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=

View File

@ -3,26 +3,22 @@ package protowire;
option go_package = "github.com/kaspanet/kaspad/protowire"; option go_package = "github.com/kaspanet/kaspad/protowire";
message RequestAddressesMessage{ message RequestAddressesMessage {
bool includeAllSubnetworks = 1; bool includeAllSubnetworks = 1;
SubnetworkId subnetworkId = 2; SubnetworkId subnetworkId = 2;
} }
message AddressesMessage{ message AddressesMessage { repeated NetAddress addressList = 1; }
repeated NetAddress addressList = 1;
}
message NetAddress{ message NetAddress {
int64 timestamp = 1; int64 timestamp = 1;
bytes ip = 3; bytes ip = 3;
uint32 port = 4; uint32 port = 4;
} }
message SubnetworkId{ message SubnetworkId { bytes bytes = 1; }
bytes bytes = 1;
}
message TransactionMessage{ message TransactionMessage {
uint32 version = 1; uint32 version = 1;
repeated TransactionInput inputs = 2; repeated TransactionInput inputs = 2;
repeated TransactionOutput outputs = 3; repeated TransactionOutput outputs = 3;
@ -30,39 +26,38 @@ message TransactionMessage{
SubnetworkId subnetworkId = 5; SubnetworkId subnetworkId = 5;
uint64 gas = 6; uint64 gas = 6;
bytes payload = 8; bytes payload = 8;
uint64 mass = 9;
} }
message TransactionInput{ message TransactionInput {
Outpoint previousOutpoint = 1; Outpoint previousOutpoint = 1;
bytes signatureScript = 2; bytes signatureScript = 2;
uint64 sequence = 3; uint64 sequence = 3;
uint32 sigOpCount = 4; uint32 sigOpCount = 4;
} }
message Outpoint{ message Outpoint {
TransactionId transactionId = 1; TransactionId transactionId = 1;
uint32 index = 2; uint32 index = 2;
} }
message TransactionId{ message TransactionId { bytes bytes = 1; }
bytes bytes = 1;
}
message ScriptPublicKey { message ScriptPublicKey {
bytes script = 1; bytes script = 1;
uint32 version = 2; uint32 version = 2;
} }
message TransactionOutput{ message TransactionOutput {
uint64 value = 1; uint64 value = 1;
ScriptPublicKey scriptPublicKey = 2; ScriptPublicKey scriptPublicKey = 2;
} }
message BlockMessage{ message BlockMessage {
BlockHeader header = 1; BlockHeader header = 1;
repeated TransactionMessage transactions = 2; repeated TransactionMessage transactions = 2;
} }
message BlockHeader{ message BlockHeader {
uint32 version = 1; uint32 version = 1;
repeated BlockLevelParents parents = 12; repeated BlockLevelParents parents = 12;
Hash hashMerkleRoot = 3; Hash hashMerkleRoot = 3;
@ -77,66 +72,43 @@ message BlockHeader{
uint64 blueScore = 13; uint64 blueScore = 13;
} }
message BlockLevelParents { message BlockLevelParents { repeated Hash parentHashes = 1; }
repeated Hash parentHashes = 1;
}
message Hash{ message Hash { bytes bytes = 1; }
bytes bytes = 1;
}
message RequestBlockLocatorMessage{ message RequestBlockLocatorMessage {
Hash highHash = 1; Hash highHash = 1;
uint32 limit = 2; uint32 limit = 2;
} }
message BlockLocatorMessage{ message BlockLocatorMessage { repeated Hash hashes = 1; }
repeated Hash hashes = 1;
}
message RequestHeadersMessage{ message RequestHeadersMessage {
Hash lowHash = 1; Hash lowHash = 1;
Hash highHash = 2; Hash highHash = 2;
} }
message RequestNextHeadersMessage{ message RequestNextHeadersMessage {}
}
message DoneHeadersMessage{ message DoneHeadersMessage {}
}
message RequestRelayBlocksMessage{ message RequestRelayBlocksMessage { repeated Hash hashes = 1; }
repeated Hash hashes = 1;
}
message RequestTransactionsMessage { message RequestTransactionsMessage { repeated TransactionId ids = 1; }
repeated TransactionId ids = 1;
}
message TransactionNotFoundMessage{ message TransactionNotFoundMessage { TransactionId id = 1; }
TransactionId id = 1;
}
message InvRelayBlockMessage{ message InvRelayBlockMessage { Hash hash = 1; }
Hash hash = 1;
}
message InvTransactionsMessage{ message InvTransactionsMessage { repeated TransactionId ids = 1; }
repeated TransactionId ids = 1;
}
message PingMessage{ message PingMessage { uint64 nonce = 1; }
uint64 nonce = 1;
}
message PongMessage{ message PongMessage { uint64 nonce = 1; }
uint64 nonce = 1;
}
message VerackMessage{ message VerackMessage {}
}
message VersionMessage{ message VersionMessage {
uint32 protocolVersion = 1; uint32 protocolVersion = 1;
uint64 services = 2; uint64 services = 2;
int64 timestamp = 3; int64 timestamp = 3;
@ -148,19 +120,15 @@ message VersionMessage{
string network = 10; string network = 10;
} }
message RejectMessage{ message RejectMessage { string reason = 1; }
string reason = 1;
}
message RequestPruningPointUTXOSetMessage{ message RequestPruningPointUTXOSetMessage { Hash pruningPointHash = 1; }
Hash pruningPointHash = 1;
}
message PruningPointUtxoSetChunkMessage{ message PruningPointUtxoSetChunkMessage {
repeated OutpointAndUtxoEntryPair outpointAndUtxoEntryPairs = 1; repeated OutpointAndUtxoEntryPair outpointAndUtxoEntryPairs = 1;
} }
message OutpointAndUtxoEntryPair{ message OutpointAndUtxoEntryPair {
Outpoint outpoint = 1; Outpoint outpoint = 1;
UtxoEntry utxoEntry = 2; UtxoEntry utxoEntry = 2;
} }
@ -172,54 +140,40 @@ message UtxoEntry {
bool isCoinbase = 4; bool isCoinbase = 4;
} }
message RequestNextPruningPointUtxoSetChunkMessage { message RequestNextPruningPointUtxoSetChunkMessage {}
}
message DonePruningPointUtxoSetChunksMessage { message DonePruningPointUtxoSetChunksMessage {}
}
message RequestIBDBlocksMessage{ message RequestIBDBlocksMessage { repeated Hash hashes = 1; }
repeated Hash hashes = 1;
}
message UnexpectedPruningPointMessage{ message UnexpectedPruningPointMessage {}
}
message IbdBlockLocatorMessage { message IbdBlockLocatorMessage {
Hash targetHash = 1; Hash targetHash = 1;
repeated Hash blockLocatorHashes = 2; repeated Hash blockLocatorHashes = 2;
} }
message RequestIBDChainBlockLocatorMessage{ message RequestIBDChainBlockLocatorMessage {
Hash lowHash = 1; Hash lowHash = 1;
Hash highHash = 2; Hash highHash = 2;
} }
message IbdChainBlockLocatorMessage { message IbdChainBlockLocatorMessage { repeated Hash blockLocatorHashes = 1; }
repeated Hash blockLocatorHashes = 1;
}
message RequestAnticoneMessage{ message RequestAnticoneMessage {
Hash blockHash = 1; Hash blockHash = 1;
Hash contextHash = 2; Hash contextHash = 2;
} }
message IbdBlockLocatorHighestHashMessage { message IbdBlockLocatorHighestHashMessage { Hash highestHash = 1; }
Hash highestHash = 1;
}
message IbdBlockLocatorHighestHashNotFoundMessage { message IbdBlockLocatorHighestHashNotFoundMessage {}
}
message BlockHeadersMessage { message BlockHeadersMessage { repeated BlockHeader blockHeaders = 1; }
repeated BlockHeader blockHeaders = 1;
}
message RequestPruningPointAndItsAnticoneMessage { message RequestPruningPointAndItsAnticoneMessage {}
}
message RequestNextPruningPointAndItsAnticoneBlocksMessage{ message RequestNextPruningPointAndItsAnticoneBlocksMessage {}
}
message BlockWithTrustedDataMessage { message BlockWithTrustedDataMessage {
BlockMessage block = 1; BlockMessage block = 1;
@ -257,26 +211,19 @@ message BluesAnticoneSizes {
uint32 anticoneSize = 2; uint32 anticoneSize = 2;
} }
message DoneBlocksWithTrustedDataMessage { message DoneBlocksWithTrustedDataMessage {}
}
message PruningPointsMessage { message PruningPointsMessage { repeated BlockHeader headers = 1; }
repeated BlockHeader headers = 1;
}
message RequestPruningPointProofMessage { message RequestPruningPointProofMessage {}
}
message PruningPointProofMessage { message PruningPointProofMessage {
repeated PruningPointProofHeaderArray headers = 1; repeated PruningPointProofHeaderArray headers = 1;
} }
message PruningPointProofHeaderArray { message PruningPointProofHeaderArray { repeated BlockHeader headers = 1; }
repeated BlockHeader headers = 1;
}
message ReadyMessage { message ReadyMessage {}
}
message BlockWithTrustedDataV4Message { message BlockWithTrustedDataV4Message {
BlockMessage block = 1; BlockMessage block = 1;

View File

@ -1,11 +1,14 @@
// RPC-related types. Request messages, response messages, and dependant types. // RPC-related types. Request messages, response messages, and dependant types.
// //
// Clients are expected to build RequestMessages and wrap them in KaspadMessage. (see messages.proto) // Clients are expected to build RequestMessages and wrap them in KaspadMessage.
// (see messages.proto)
// //
// Having received a RequestMessage, (wrapped in a KaspadMessage) the RPC server will respond with a // Having received a RequestMessage, (wrapped in a KaspadMessage) the RPC server
// ResponseMessage (likewise wrapped in a KaspadMessage) respective to the original RequestMessage. // will respond with a ResponseMessage (likewise wrapped in a KaspadMessage)
// respective to the original RequestMessage.
// //
// **IMPORTANT:** This API is a work in progress and is subject to break between versions. // **IMPORTANT:** This API is a work in progress and is subject to break between
// versions.
// //
syntax = "proto3"; syntax = "proto3";
package protowire; package protowire;
@ -14,10 +17,9 @@ option go_package = "github.com/kaspanet/kaspad/protowire";
// RPCError represents a generic non-internal error. // RPCError represents a generic non-internal error.
// //
// Receivers of any ResponseMessage are expected to check whether its error field is not null. // Receivers of any ResponseMessage are expected to check whether its error
message RPCError{ // field is not null.
string message = 1; message RPCError { string message = 1; }
}
message RpcBlock { message RpcBlock {
RpcBlockHeader header = 1; RpcBlockHeader header = 1;
@ -40,11 +42,9 @@ message RpcBlockHeader {
uint64 blueScore = 13; uint64 blueScore = 13;
} }
message RpcBlockLevelParents { message RpcBlockLevelParents { repeated string parentHashes = 1; }
repeated string parentHashes = 1;
}
message RpcBlockVerboseData{ message RpcBlockVerboseData {
string hash = 1; string hash = 1;
double difficulty = 11; double difficulty = 11;
string selectedParentHash = 13; string selectedParentHash = 13;
@ -66,6 +66,7 @@ message RpcTransaction {
uint64 gas = 6; uint64 gas = 6;
string payload = 8; string payload = 8;
RpcTransactionVerboseData verboseData = 9; RpcTransactionVerboseData verboseData = 9;
uint64 mass = 10;
} }
message RpcTransactionInput { message RpcTransactionInput {
@ -99,7 +100,7 @@ message RpcUtxoEntry {
bool isCoinbase = 4; bool isCoinbase = 4;
} }
message RpcTransactionVerboseData{ message RpcTransactionVerboseData {
string transactionId = 1; string transactionId = 1;
string hash = 2; string hash = 2;
uint64 mass = 4; uint64 mass = 4;
@ -107,35 +108,35 @@ message RpcTransactionVerboseData{
uint64 blockTime = 14; uint64 blockTime = 14;
} }
message RpcTransactionInputVerboseData{ message RpcTransactionInputVerboseData {}
}
message RpcTransactionOutputVerboseData{ message RpcTransactionOutputVerboseData {
string scriptPublicKeyType = 5; string scriptPublicKeyType = 5;
string scriptPublicKeyAddress = 6; string scriptPublicKeyAddress = 6;
} }
// GetCurrentNetworkRequestMessage requests the network kaspad is currently running against. // GetCurrentNetworkRequestMessage requests the network kaspad is currently
// running against.
// //
// Possible networks are: Mainnet, Testnet, Simnet, Devnet // Possible networks are: Mainnet, Testnet, Simnet, Devnet
message GetCurrentNetworkRequestMessage{ message GetCurrentNetworkRequestMessage {}
}
message GetCurrentNetworkResponseMessage{ message GetCurrentNetworkResponseMessage {
string currentNetwork = 1; string currentNetwork = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// SubmitBlockRequestMessage requests to submit a block into the DAG. // SubmitBlockRequestMessage requests to submit a block into the DAG.
// Blocks are generally expected to have been generated using the getBlockTemplate call. // Blocks are generally expected to have been generated using the
// getBlockTemplate call.
// //
// See: GetBlockTemplateRequestMessage // See: GetBlockTemplateRequestMessage
message SubmitBlockRequestMessage{ message SubmitBlockRequestMessage {
RpcBlock block = 2; RpcBlock block = 2;
bool allowNonDAABlocks = 3; bool allowNonDAABlocks = 3;
} }
message SubmitBlockResponseMessage{ message SubmitBlockResponseMessage {
enum RejectReason { enum RejectReason {
NONE = 0; NONE = 0;
BLOCK_INVALID = 1; BLOCK_INVALID = 1;
@ -146,115 +147,108 @@ message SubmitBlockResponseMessage{
} }
// GetBlockTemplateRequestMessage requests a current block template. // GetBlockTemplateRequestMessage requests a current block template.
// Callers are expected to solve the block template and submit it using the submitBlock call // Callers are expected to solve the block template and submit it using the
// submitBlock call
// //
// See: SubmitBlockRequestMessage // See: SubmitBlockRequestMessage
message GetBlockTemplateRequestMessage{ message GetBlockTemplateRequestMessage {
// Which kaspa address should the coinbase block reward transaction pay into // Which kaspa address should the coinbase block reward transaction pay into
string payAddress = 1; string payAddress = 1;
string extraData = 2; string extraData = 2;
} }
message GetBlockTemplateResponseMessage{ message GetBlockTemplateResponseMessage {
RpcBlock block = 3; RpcBlock block = 3;
// Whether kaspad thinks that it's synced. // Whether kaspad thinks that it's synced.
// Callers are discouraged (but not forbidden) from solving blocks when kaspad is not synced. // Callers are discouraged (but not forbidden) from solving blocks when kaspad
// That is because when kaspad isn't in sync with the rest of the network there's a high // is not synced. That is because when kaspad isn't in sync with the rest of
// chance the block will never be accepted, thus the solving effort would have been wasted. // the network there's a high chance the block will never be accepted, thus
// the solving effort would have been wasted.
bool isSynced = 2; bool isSynced = 2;
RPCError error = 1000; RPCError error = 1000;
} }
// NotifyBlockAddedRequestMessage registers this connection for blockAdded notifications. // NotifyBlockAddedRequestMessage registers this connection for blockAdded
// notifications.
// //
// See: BlockAddedNotificationMessage // See: BlockAddedNotificationMessage
message NotifyBlockAddedRequestMessage{ message NotifyBlockAddedRequestMessage {}
}
message NotifyBlockAddedResponseMessage{ message NotifyBlockAddedResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// BlockAddedNotificationMessage is sent whenever a blocks has been added (NOT accepted) // BlockAddedNotificationMessage is sent whenever a blocks has been added (NOT
// into the DAG. // accepted) into the DAG.
// //
// See: NotifyBlockAddedRequestMessage // See: NotifyBlockAddedRequestMessage
message BlockAddedNotificationMessage{ message BlockAddedNotificationMessage { RpcBlock block = 3; }
RpcBlock block = 3;
}
// GetPeerAddressesRequestMessage requests the list of known kaspad addresses in the // GetPeerAddressesRequestMessage requests the list of known kaspad addresses in
// current network. (mainnet, testnet, etc.) // the current network. (mainnet, testnet, etc.)
message GetPeerAddressesRequestMessage{ message GetPeerAddressesRequestMessage {}
}
message GetPeerAddressesResponseMessage{ message GetPeerAddressesResponseMessage {
repeated GetPeerAddressesKnownAddressMessage addresses = 1; repeated GetPeerAddressesKnownAddressMessage addresses = 1;
repeated GetPeerAddressesKnownAddressMessage bannedAddresses = 2; repeated GetPeerAddressesKnownAddressMessage bannedAddresses = 2;
RPCError error = 1000; RPCError error = 1000;
} }
message GetPeerAddressesKnownAddressMessage { message GetPeerAddressesKnownAddressMessage { string Addr = 1; }
string Addr = 1;
}
// GetSelectedTipHashRequestMessage requests the hash of the current virtual's // GetSelectedTipHashRequestMessage requests the hash of the current virtual's
// selected parent. // selected parent.
message GetSelectedTipHashRequestMessage{ message GetSelectedTipHashRequestMessage {}
}
message GetSelectedTipHashResponseMessage{ message GetSelectedTipHashResponseMessage {
string selectedTipHash = 1; string selectedTipHash = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// GetMempoolEntryRequestMessage requests information about a specific transaction // GetMempoolEntryRequestMessage requests information about a specific
// in the mempool. // transaction in the mempool.
message GetMempoolEntryRequestMessage{ message GetMempoolEntryRequestMessage {
// The transaction's TransactionID. // The transaction's TransactionID.
string txId = 1; string txId = 1;
bool includeOrphanPool = 2; bool includeOrphanPool = 2;
bool filterTransactionPool = 3; bool filterTransactionPool = 3;
} }
message GetMempoolEntryResponseMessage{ message GetMempoolEntryResponseMessage {
MempoolEntry entry = 1; MempoolEntry entry = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// GetMempoolEntriesRequestMessage requests information about all the transactions // GetMempoolEntriesRequestMessage requests information about all the
// currently in the mempool. // transactions currently in the mempool.
message GetMempoolEntriesRequestMessage{ message GetMempoolEntriesRequestMessage {
bool includeOrphanPool = 1; bool includeOrphanPool = 1;
bool filterTransactionPool = 2; bool filterTransactionPool = 2;
} }
message GetMempoolEntriesResponseMessage{ message GetMempoolEntriesResponseMessage {
repeated MempoolEntry entries = 1; repeated MempoolEntry entries = 1;
RPCError error = 1000; RPCError error = 1000;
} }
message MempoolEntry{ message MempoolEntry {
uint64 fee = 1; uint64 fee = 1;
RpcTransaction transaction = 3; RpcTransaction transaction = 3;
bool isOrphan = 4; bool isOrphan = 4;
} }
// GetConnectedPeerInfoRequestMessage requests information about all the p2p peers // GetConnectedPeerInfoRequestMessage requests information about all the p2p
// currently connected to this kaspad. // peers currently connected to this kaspad.
message GetConnectedPeerInfoRequestMessage{ message GetConnectedPeerInfoRequestMessage {}
}
message GetConnectedPeerInfoResponseMessage{ message GetConnectedPeerInfoResponseMessage {
repeated GetConnectedPeerInfoMessage infos = 1; repeated GetConnectedPeerInfoMessage infos = 1;
RPCError error = 1000; RPCError error = 1000;
} }
message GetConnectedPeerInfoMessage{ message GetConnectedPeerInfoMessage {
string id = 1; string id = 1;
string address = 2; string address = 2;
@ -278,58 +272,58 @@ message GetConnectedPeerInfoMessage{
// AddPeerRequestMessage adds a peer to kaspad's outgoing connection list. // AddPeerRequestMessage adds a peer to kaspad's outgoing connection list.
// This will, in most cases, result in kaspad connecting to said peer. // This will, in most cases, result in kaspad connecting to said peer.
message AddPeerRequestMessage{ message AddPeerRequestMessage {
string address = 1; string address = 1;
// Whether to keep attempting to connect to this peer after disconnection // Whether to keep attempting to connect to this peer after disconnection
bool isPermanent = 2; bool isPermanent = 2;
} }
message AddPeerResponseMessage{ message AddPeerResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// SubmitTransactionRequestMessage submits a transaction to the mempool // SubmitTransactionRequestMessage submits a transaction to the mempool
message SubmitTransactionRequestMessage{ message SubmitTransactionRequestMessage {
RpcTransaction transaction = 1; RpcTransaction transaction = 1;
bool allowOrphan = 2; bool allowOrphan = 2;
} }
message SubmitTransactionResponseMessage{ message SubmitTransactionResponseMessage {
// The transaction ID of the submitted transaction // The transaction ID of the submitted transaction
string transactionId = 1; string transactionId = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// NotifyVirtualSelectedParentChainChangedRequestMessage registers this connection for virtualSelectedParentChainChanged notifications. // NotifyVirtualSelectedParentChainChangedRequestMessage registers this
// connection for virtualSelectedParentChainChanged notifications.
// //
// See: VirtualSelectedParentChainChangedNotificationMessage // See: VirtualSelectedParentChainChangedNotificationMessage
message NotifyVirtualSelectedParentChainChangedRequestMessage{ message NotifyVirtualSelectedParentChainChangedRequestMessage {
bool includeAcceptedTransactionIds = 1; bool includeAcceptedTransactionIds = 1;
} }
message NotifyVirtualSelectedParentChainChangedResponseMessage{ message NotifyVirtualSelectedParentChainChangedResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// VirtualSelectedParentChainChangedNotificationMessage is sent whenever the DAG's selected parent // VirtualSelectedParentChainChangedNotificationMessage is sent whenever the
// chain had changed. // DAG's selected parent chain had changed.
// //
// See: NotifyVirtualSelectedParentChainChangedRequestMessage // See: NotifyVirtualSelectedParentChainChangedRequestMessage
message VirtualSelectedParentChainChangedNotificationMessage{ message VirtualSelectedParentChainChangedNotificationMessage {
// The chain blocks that were removed, in high-to-low order // The chain blocks that were removed, in high-to-low order
repeated string removedChainBlockHashes = 1; repeated string removedChainBlockHashes = 1;
// The chain blocks that were added, in low-to-high order // The chain blocks that were added, in low-to-high order
repeated string addedChainBlockHashes = 3; repeated string addedChainBlockHashes = 3;
// Will be filled only if `includeAcceptedTransactionIds = true` in the notify request. // Will be filled only if `includeAcceptedTransactionIds = true` in the notify
// request.
repeated AcceptedTransactionIds acceptedTransactionIds = 2; repeated AcceptedTransactionIds acceptedTransactionIds = 2;
} }
// GetBlockRequestMessage requests information about a specific block // GetBlockRequestMessage requests information about a specific block
message GetBlockRequestMessage{ message GetBlockRequestMessage {
// The hash of the requested block // The hash of the requested block
string hash = 1; string hash = 1;
@ -337,7 +331,7 @@ message GetBlockRequestMessage{
bool includeTransactions = 3; bool includeTransactions = 3;
} }
message GetBlockResponseMessage{ message GetBlockResponseMessage {
RpcBlock block = 3; RpcBlock block = 3;
RPCError error = 1000; RPCError error = 1000;
} }
@ -345,28 +339,26 @@ message GetBlockResponseMessage{
// GetSubnetworkRequestMessage requests information about a specific subnetwork // GetSubnetworkRequestMessage requests information about a specific subnetwork
// //
// Currently unimplemented // Currently unimplemented
message GetSubnetworkRequestMessage{ message GetSubnetworkRequestMessage { string subnetworkId = 1; }
string subnetworkId = 1;
}
message GetSubnetworkResponseMessage{ message GetSubnetworkResponseMessage {
uint64 gasLimit = 1; uint64 gasLimit = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// GetVirtualSelectedParentChainFromBlockRequestMessage requests the virtual selected // GetVirtualSelectedParentChainFromBlockRequestMessage requests the virtual
// parent chain from some startHash to this kaspad's current virtual // selected parent chain from some startHash to this kaspad's current virtual
message GetVirtualSelectedParentChainFromBlockRequestMessage{ message GetVirtualSelectedParentChainFromBlockRequestMessage {
string startHash = 1; string startHash = 1;
bool includeAcceptedTransactionIds = 2; bool includeAcceptedTransactionIds = 2;
} }
message AcceptedTransactionIds{ message AcceptedTransactionIds {
string acceptingBlockHash = 1; string acceptingBlockHash = 1;
repeated string acceptedTransactionIds = 2; repeated string acceptedTransactionIds = 2;
} }
message GetVirtualSelectedParentChainFromBlockResponseMessage{ message GetVirtualSelectedParentChainFromBlockResponseMessage {
// The chain blocks that were removed, in high-to-low order // The chain blocks that were removed, in high-to-low order
repeated string removedChainBlockHashes = 1; repeated string removedChainBlockHashes = 1;
@ -374,43 +366,42 @@ message GetVirtualSelectedParentChainFromBlockResponseMessage{
repeated string addedChainBlockHashes = 3; repeated string addedChainBlockHashes = 3;
// The transactions accepted by each block in addedChainBlockHashes. // The transactions accepted by each block in addedChainBlockHashes.
// Will be filled only if `includeAcceptedTransactionIds = true` in the request. // Will be filled only if `includeAcceptedTransactionIds = true` in the
// request.
repeated AcceptedTransactionIds acceptedTransactionIds = 2; repeated AcceptedTransactionIds acceptedTransactionIds = 2;
RPCError error = 1000; RPCError error = 1000;
} }
// GetBlocksRequestMessage requests blocks between a certain block lowHash up to this // GetBlocksRequestMessage requests blocks between a certain block lowHash up to
// kaspad's current virtual. // this kaspad's current virtual.
message GetBlocksRequestMessage{ message GetBlocksRequestMessage {
string lowHash = 1; string lowHash = 1;
bool includeBlocks = 2; bool includeBlocks = 2;
bool includeTransactions = 3; bool includeTransactions = 3;
} }
message GetBlocksResponseMessage{ message GetBlocksResponseMessage {
repeated string blockHashes = 4; repeated string blockHashes = 4;
repeated RpcBlock blocks = 3; repeated RpcBlock blocks = 3;
RPCError error = 1000; RPCError error = 1000;
} }
// GetBlockCountRequestMessage requests the current number of blocks in this kaspad. // GetBlockCountRequestMessage requests the current number of blocks in this
// Note that this number may decrease as pruning occurs. // kaspad. Note that this number may decrease as pruning occurs.
message GetBlockCountRequestMessage{ message GetBlockCountRequestMessage {}
}
message GetBlockCountResponseMessage{ message GetBlockCountResponseMessage {
uint64 blockCount = 1; uint64 blockCount = 1;
uint64 headerCount = 2; uint64 headerCount = 2;
RPCError error = 1000; RPCError error = 1000;
} }
// GetBlockDagInfoRequestMessage requests general information about the current state // GetBlockDagInfoRequestMessage requests general information about the current
// of this kaspad's DAG. // state of this kaspad's DAG.
message GetBlockDagInfoRequestMessage{ message GetBlockDagInfoRequestMessage {}
}
message GetBlockDagInfoResponseMessage{ message GetBlockDagInfoResponseMessage {
string networkName = 1; string networkName = 1;
uint64 blockCount = 2; uint64 blockCount = 2;
uint64 headerCount = 3; uint64 headerCount = 3;
@ -423,52 +414,40 @@ message GetBlockDagInfoResponseMessage{
RPCError error = 1000; RPCError error = 1000;
} }
message ResolveFinalityConflictRequestMessage{ message ResolveFinalityConflictRequestMessage { string finalityBlockHash = 1; }
string finalityBlockHash = 1;
}
message ResolveFinalityConflictResponseMessage{ message ResolveFinalityConflictResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
message NotifyFinalityConflictsRequestMessage{ message NotifyFinalityConflictsRequestMessage {}
}
message NotifyFinalityConflictsResponseMessage{ message NotifyFinalityConflictsResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
message FinalityConflictNotificationMessage{ message FinalityConflictNotificationMessage { string violatingBlockHash = 1; }
string violatingBlockHash = 1;
}
message FinalityConflictResolvedNotificationMessage{ message FinalityConflictResolvedNotificationMessage {
string finalityBlockHash = 1; string finalityBlockHash = 1;
} }
// ShutDownRequestMessage shuts down this kaspad. // ShutDownRequestMessage shuts down this kaspad.
message ShutDownRequestMessage{ message ShutDownRequestMessage {}
}
message ShutDownResponseMessage{ message ShutDownResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// GetHeadersRequestMessage requests headers between the given startHash and the // GetHeadersRequestMessage requests headers between the given startHash and the
// current virtual, up to the given limit. // current virtual, up to the given limit.
message GetHeadersRequestMessage{ message GetHeadersRequestMessage {
string startHash = 1; string startHash = 1;
uint64 limit = 2; uint64 limit = 2;
bool isAscending = 3; bool isAscending = 3;
} }
message GetHeadersResponseMessage{ message GetHeadersResponseMessage {
repeated string headers = 1; repeated string headers = 1;
RPCError error = 1000; RPCError error = 1000;
} }
// NotifyUtxosChangedRequestMessage registers this connection for utxoChanged notifications // NotifyUtxosChangedRequestMessage registers this connection for utxoChanged
// for the given addresses. // notifications for the given addresses.
// //
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
// //
@ -477,11 +456,10 @@ message NotifyUtxosChangedRequestMessage {
repeated string addresses = 1; // Leave empty to get all updates repeated string addresses = 1; // Leave empty to get all updates
} }
message NotifyUtxosChangedResponseMessage { message NotifyUtxosChangedResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// UtxosChangedNotificationMessage is sent whenever the UTXO index had been updated. // UtxosChangedNotificationMessage is sent whenever the UTXO index had been
// updated.
// //
// See: NotifyUtxosChangedRequestMessage // See: NotifyUtxosChangedRequestMessage
message UtxosChangedNotificationMessage { message UtxosChangedNotificationMessage {
@ -495,8 +473,8 @@ message UtxosByAddressesEntry {
RpcUtxoEntry utxoEntry = 3; RpcUtxoEntry utxoEntry = 3;
} }
// StopNotifyingUtxosChangedRequestMessage unregisters this connection for utxoChanged notifications // StopNotifyingUtxosChangedRequestMessage unregisters this connection for
// for the given addresses. // utxoChanged notifications for the given addresses.
// //
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
// //
@ -505,16 +483,13 @@ message StopNotifyingUtxosChangedRequestMessage {
repeated string addresses = 1; repeated string addresses = 1;
} }
message StopNotifyingUtxosChangedResponseMessage { message StopNotifyingUtxosChangedResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// GetUtxosByAddressesRequestMessage requests all current UTXOs for the given kaspad addresses // GetUtxosByAddressesRequestMessage requests all current UTXOs for the given
// kaspad addresses
// //
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
message GetUtxosByAddressesRequestMessage { message GetUtxosByAddressesRequestMessage { repeated string addresses = 1; }
repeated string addresses = 1;
}
message GetUtxosByAddressesResponseMessage { message GetUtxosByAddressesResponseMessage {
repeated UtxosByAddressesEntry entries = 1; repeated UtxosByAddressesEntry entries = 1;
@ -522,12 +497,11 @@ message GetUtxosByAddressesResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// GetBalanceByAddressRequest returns the total balance in unspent transactions towards a given address // GetBalanceByAddressRequest returns the total balance in unspent transactions
// towards a given address
// //
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
message GetBalanceByAddressRequestMessage { message GetBalanceByAddressRequestMessage { string address = 1; }
string address = 1;
}
message GetBalanceByAddressResponseMessage { message GetBalanceByAddressResponseMessage {
uint64 balance = 1; uint64 balance = 1;
@ -535,11 +509,9 @@ message GetBalanceByAddressResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
message GetBalancesByAddressesRequestMessage { message GetBalancesByAddressesRequestMessage { repeated string addresses = 1; }
repeated string addresses = 1;
}
message BalancesByAddressEntry{ message BalancesByAddressEntry {
string address = 1; string address = 1;
uint64 balance = 2; uint64 balance = 2;
@ -552,10 +524,9 @@ message GetBalancesByAddressesResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// GetVirtualSelectedParentBlueScoreRequestMessage requests the blue score of the current selected parent // GetVirtualSelectedParentBlueScoreRequestMessage requests the blue score of
// of the virtual block. // the current selected parent of the virtual block.
message GetVirtualSelectedParentBlueScoreRequestMessage { message GetVirtualSelectedParentBlueScoreRequestMessage {}
}
message GetVirtualSelectedParentBlueScoreResponseMessage { message GetVirtualSelectedParentBlueScoreResponseMessage {
uint64 blueScore = 1; uint64 blueScore = 1;
@ -563,19 +534,18 @@ message GetVirtualSelectedParentBlueScoreResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// NotifyVirtualSelectedParentBlueScoreChangedRequestMessage registers this connection for // NotifyVirtualSelectedParentBlueScoreChangedRequestMessage registers this
// virtualSelectedParentBlueScoreChanged notifications. // connection for virtualSelectedParentBlueScoreChanged notifications.
// //
// See: VirtualSelectedParentBlueScoreChangedNotificationMessage // See: VirtualSelectedParentBlueScoreChangedNotificationMessage
message NotifyVirtualSelectedParentBlueScoreChangedRequestMessage { message NotifyVirtualSelectedParentBlueScoreChangedRequestMessage {}
}
message NotifyVirtualSelectedParentBlueScoreChangedResponseMessage { message NotifyVirtualSelectedParentBlueScoreChangedResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// VirtualSelectedParentBlueScoreChangedNotificationMessage is sent whenever the blue score // VirtualSelectedParentBlueScoreChangedNotificationMessage is sent whenever the
// of the virtual's selected parent changes. // blue score of the virtual's selected parent changes.
// //
// See NotifyVirtualSelectedParentBlueScoreChangedRequestMessage // See NotifyVirtualSelectedParentBlueScoreChangedRequestMessage
message VirtualSelectedParentBlueScoreChangedNotificationMessage { message VirtualSelectedParentBlueScoreChangedNotificationMessage {
@ -586,12 +556,9 @@ message VirtualSelectedParentBlueScoreChangedNotificationMessage {
// virtualDaaScoreChanged notifications. // virtualDaaScoreChanged notifications.
// //
// See: VirtualDaaScoreChangedNotificationMessage // See: VirtualDaaScoreChangedNotificationMessage
message NotifyVirtualDaaScoreChangedRequestMessage { message NotifyVirtualDaaScoreChangedRequestMessage {}
}
message NotifyVirtualDaaScoreChangedResponseMessage { message NotifyVirtualDaaScoreChangedResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// VirtualDaaScoreChangedNotificationMessage is sent whenever the DAA score // VirtualDaaScoreChangedNotificationMessage is sent whenever the DAA score
// of the virtual changes. // of the virtual changes.
@ -607,57 +574,44 @@ message VirtualDaaScoreChangedNotificationMessage {
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
// //
// See: NotifyPruningPointUTXOSetOverrideResponseMessage // See: NotifyPruningPointUTXOSetOverrideResponseMessage
message NotifyPruningPointUTXOSetOverrideRequestMessage { message NotifyPruningPointUTXOSetOverrideRequestMessage {}
}
message NotifyPruningPointUTXOSetOverrideResponseMessage { message NotifyPruningPointUTXOSetOverrideResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// PruningPointUTXOSetOverrideNotificationMessage is sent whenever the UTXO index // PruningPointUTXOSetOverrideNotificationMessage is sent whenever the UTXO
// resets due to pruning point change via IBD. // index resets due to pruning point change via IBD.
// //
// See NotifyPruningPointUTXOSetOverrideRequestMessage // See NotifyPruningPointUTXOSetOverrideRequestMessage
message PruningPointUTXOSetOverrideNotificationMessage { message PruningPointUTXOSetOverrideNotificationMessage {}
}
// StopNotifyingPruningPointUTXOSetOverrideRequestMessage unregisters this connection for // StopNotifyingPruningPointUTXOSetOverrideRequestMessage unregisters this
// pruning point UTXO set override notifications. // connection for pruning point UTXO set override notifications.
// //
// This call is only available when this kaspad was started with `--utxoindex` // This call is only available when this kaspad was started with `--utxoindex`
// //
// See: PruningPointUTXOSetOverrideNotificationMessage // See: PruningPointUTXOSetOverrideNotificationMessage
message StopNotifyingPruningPointUTXOSetOverrideRequestMessage { message StopNotifyingPruningPointUTXOSetOverrideRequestMessage {}
}
message StopNotifyingPruningPointUTXOSetOverrideResponseMessage { message StopNotifyingPruningPointUTXOSetOverrideResponseMessage {
RPCError error = 1000; RPCError error = 1000;
} }
// BanRequestMessage bans the given ip. // BanRequestMessage bans the given ip.
message BanRequestMessage{ message BanRequestMessage { string ip = 1; }
string ip = 1;
}
message BanResponseMessage{ message BanResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// UnbanRequestMessage unbans the given ip. // UnbanRequestMessage unbans the given ip.
message UnbanRequestMessage{ message UnbanRequestMessage { string ip = 1; }
string ip = 1;
}
message UnbanResponseMessage{ message UnbanResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// GetInfoRequestMessage returns info about the node. // GetInfoRequestMessage returns info about the node.
message GetInfoRequestMessage{ message GetInfoRequestMessage {}
}
message GetInfoResponseMessage{ message GetInfoResponseMessage {
string p2pId = 1; string p2pId = 1;
uint64 mempoolSize = 2; uint64 mempoolSize = 2;
string serverVersion = 3; string serverVersion = 3;
@ -666,12 +620,12 @@ message GetInfoResponseMessage{
RPCError error = 1000; RPCError error = 1000;
} }
message EstimateNetworkHashesPerSecondRequestMessage{ message EstimateNetworkHashesPerSecondRequestMessage {
uint32 windowSize = 1; uint32 windowSize = 1;
string startHash = 2; string startHash = 2;
} }
message EstimateNetworkHashesPerSecondResponseMessage{ message EstimateNetworkHashesPerSecondResponseMessage {
uint64 networkHashesPerSecond = 1; uint64 networkHashesPerSecond = 1;
RPCError error = 1000; RPCError error = 1000;
} }
@ -680,50 +634,46 @@ message EstimateNetworkHashesPerSecondResponseMessage{
// NewBlockTemplate notifications. // NewBlockTemplate notifications.
// //
// See: NewBlockTemplateNotificationMessage // See: NewBlockTemplateNotificationMessage
message NotifyNewBlockTemplateRequestMessage { message NotifyNewBlockTemplateRequestMessage {}
}
message NotifyNewBlockTemplateResponseMessage { message NotifyNewBlockTemplateResponseMessage { RPCError error = 1000; }
RPCError error = 1000;
}
// NewBlockTemplateNotificationMessage is sent whenever a new updated block template is // NewBlockTemplateNotificationMessage is sent whenever a new updated block
// available for miners. // template is available for miners.
// //
// See NotifyNewBlockTemplateRequestMessage // See NotifyNewBlockTemplateRequestMessage
message NewBlockTemplateNotificationMessage { message NewBlockTemplateNotificationMessage {}
}
message MempoolEntryByAddress{ message MempoolEntryByAddress {
string address = 1; string address = 1;
repeated MempoolEntry sending = 2; repeated MempoolEntry sending = 2;
repeated MempoolEntry receiving = 3; repeated MempoolEntry receiving = 3;
} }
message GetMempoolEntriesByAddressesRequestMessage{ message GetMempoolEntriesByAddressesRequestMessage {
repeated string addresses = 1; repeated string addresses = 1;
bool includeOrphanPool = 2; bool includeOrphanPool = 2;
bool filterTransactionPool = 3; bool filterTransactionPool = 3;
} }
message GetMempoolEntriesByAddressesResponseMessage{ message GetMempoolEntriesByAddressesResponseMessage {
repeated MempoolEntryByAddress entries = 1; repeated MempoolEntryByAddress entries = 1;
RPCError error = 1000; RPCError error = 1000;
} }
message GetCoinSupplyRequestMessage{ message GetCoinSupplyRequestMessage {}
message GetCoinSupplyResponseMessage {
uint64 maxSompi =
1; // note: this is a hard coded maxSupply, actual maxSupply is expected
// to deviate by upto -5%, but cannot be measured exactly.
uint64 circulatingSompi = 2;
RPCError error = 1000;
} }
message GetCoinSupplyResponseMessage{ message PingRequestMessage {}
uint64 maxSompi = 1; // note: this is a hard coded maxSupply, actual maxSupply is expected to deviate by upto -5%, but cannot be measured exactly.
uint64 circulatingSompi = 2;
RPCError error = 1000;
}
message PingRequestMessage{
}
message PingResponseMessage { RPCError error = 1000; } message PingResponseMessage { RPCError error = 1000; }
@ -852,7 +802,7 @@ message GetDaaScoreTimestampEstimateRequestMessage {
repeated uint64 daaScores = 1; repeated uint64 daaScores = 1;
} }
message GetDaaScoreTimestampEstimateResponseMessage{ message GetDaaScoreTimestampEstimateResponseMessage {
repeated uint64 timestamps = 1; repeated uint64 timestamps = 1;
RPCError error = 1000; RPCError error = 1000;
} }

View File

@ -110,6 +110,7 @@ func (x *RpcTransaction) toAppMessage() (*appmessage.RPCTransaction, error) {
SubnetworkID: x.SubnetworkId, SubnetworkID: x.SubnetworkId,
Gas: x.Gas, Gas: x.Gas,
Payload: x.Payload, Payload: x.Payload,
Mass: x.Mass,
VerboseData: verboseData, VerboseData: verboseData,
}, nil }, nil
} }
@ -138,6 +139,7 @@ func (x *RpcTransaction) fromAppMessage(transaction *appmessage.RPCTransaction)
SubnetworkId: transaction.SubnetworkID, SubnetworkId: transaction.SubnetworkID,
Gas: transaction.Gas, Gas: transaction.Gas,
Payload: transaction.Payload, Payload: transaction.Payload,
Mass: transaction.Mass,
VerboseData: verboseData, VerboseData: verboseData,
} }
} }