mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-28 17:56:50 +00:00

* Replace BlockMessage with RpcBlock in rpc.proto. * Convert everything in kaspad to use RPCBlocks and fix tests. * Fix compilation errors in stability tests and the miner. * Update TransactionVerboseData in rpc.proto. * Update TransactionVerboseData in the rest of kaspad. * Make golint happy. * Include RpcTransactionVerboseData in RpcTransaction instead of the other way around. * Regenerate rpc.pb.go after merge. * Update appmessage types. * Update appmessage request and response types. * Reimplement conversion functions between appmessage.RPCTransaction and protowire.RpcTransaction. * Extract RpcBlockHeader toAppMessage/fromAppMessage out of RpcBlock. * Fix compilation errors in getBlock, getBlocks, and submitBlock. * Fix compilation errors in getMempoolEntry. * Fix compilation errors in notifyBlockAdded. * Update verbosedata.go. * Fix compilation errors in getBlock and getBlocks. * Fix compilation errors in getBlocks tests. * Fix conversions between getBlocks message types. * Fix integration tests. * Fix a comment. * Add selectedParent to the verbose block response.
113 lines
3.1 KiB
Go
113 lines
3.1 KiB
Go
package appmessage
|
|
|
|
// SubmitTransactionRequestMessage is an appmessage corresponding to
|
|
// its respective RPC message
|
|
type SubmitTransactionRequestMessage struct {
|
|
baseMessage
|
|
Transaction *RPCTransaction
|
|
}
|
|
|
|
// Command returns the protocol command string for the message
|
|
func (msg *SubmitTransactionRequestMessage) Command() MessageCommand {
|
|
return CmdSubmitTransactionRequestMessage
|
|
}
|
|
|
|
// NewSubmitTransactionRequestMessage returns a instance of the message
|
|
func NewSubmitTransactionRequestMessage(transaction *RPCTransaction) *SubmitTransactionRequestMessage {
|
|
return &SubmitTransactionRequestMessage{
|
|
Transaction: transaction,
|
|
}
|
|
}
|
|
|
|
// SubmitTransactionResponseMessage is an appmessage corresponding to
|
|
// its respective RPC message
|
|
type SubmitTransactionResponseMessage struct {
|
|
baseMessage
|
|
TransactionID string
|
|
|
|
Error *RPCError
|
|
}
|
|
|
|
// Command returns the protocol command string for the message
|
|
func (msg *SubmitTransactionResponseMessage) Command() MessageCommand {
|
|
return CmdSubmitTransactionResponseMessage
|
|
}
|
|
|
|
// NewSubmitTransactionResponseMessage returns a instance of the message
|
|
func NewSubmitTransactionResponseMessage(transactionID string) *SubmitTransactionResponseMessage {
|
|
return &SubmitTransactionResponseMessage{
|
|
TransactionID: transactionID,
|
|
}
|
|
}
|
|
|
|
// RPCTransaction is a kaspad transaction representation meant to be
|
|
// used over RPC
|
|
type RPCTransaction struct {
|
|
Version uint16
|
|
Inputs []*RPCTransactionInput
|
|
Outputs []*RPCTransactionOutput
|
|
LockTime uint64
|
|
SubnetworkID string
|
|
Gas uint64
|
|
Payload string
|
|
VerboseData *RPCTransactionVerboseData
|
|
}
|
|
|
|
// RPCTransactionInput is a kaspad transaction input representation
|
|
// meant to be used over RPC
|
|
type RPCTransactionInput struct {
|
|
PreviousOutpoint *RPCOutpoint
|
|
SignatureScript string
|
|
Sequence uint64
|
|
VerboseData *RPCTransactionInputVerboseData
|
|
}
|
|
|
|
// RPCScriptPublicKey is a kaspad ScriptPublicKey representation
|
|
type RPCScriptPublicKey struct {
|
|
Version uint16
|
|
Script string
|
|
}
|
|
|
|
// RPCTransactionOutput is a kaspad transaction output representation
|
|
// meant to be used over RPC
|
|
type RPCTransactionOutput struct {
|
|
Amount uint64
|
|
ScriptPublicKey *RPCScriptPublicKey
|
|
VerboseData *RPCTransactionOutputVerboseData
|
|
}
|
|
|
|
// RPCOutpoint is a kaspad outpoint representation meant to be used
|
|
// over RPC
|
|
type RPCOutpoint struct {
|
|
TransactionID string
|
|
Index uint32
|
|
}
|
|
|
|
// RPCUTXOEntry is a kaspad utxo entry representation meant to be used
|
|
// over RPC
|
|
type RPCUTXOEntry struct {
|
|
Amount uint64
|
|
ScriptPublicKey *RPCScriptPublicKey
|
|
BlockDAAScore uint64
|
|
IsCoinbase bool
|
|
}
|
|
|
|
// RPCTransactionVerboseData holds verbose data about a transaction
|
|
type RPCTransactionVerboseData struct {
|
|
TransactionID string
|
|
Hash string
|
|
Size uint64
|
|
BlockHash string
|
|
BlockTime uint64
|
|
}
|
|
|
|
// RPCTransactionInputVerboseData holds data about a transaction input
|
|
type RPCTransactionInputVerboseData struct {
|
|
}
|
|
|
|
// RPCTransactionOutputVerboseData holds data about a transaction output
|
|
type RPCTransactionOutputVerboseData struct {
|
|
ScriptPublicKeyType string
|
|
ScriptPublicKeyAddress string
|
|
}
|