From 463db63e2225d9637b64f0d9fdfd828b3f1e08d3 Mon Sep 17 00:00:00 2001 From: D-Stacks Date: Fri, 24 Jun 2022 10:52:14 +0200 Subject: [PATCH] add minimal rpc for usecase and testing. --- app/appmessage/message.go | 4 + .../rpc_get_accepting_block_hash_of_tx.go | 41 ++ app/rpc/rpc.go | 1 + .../get_accepting_block_hash_of_tx.go | 53 +++ domain/txindex/store.go | 14 +- domain/txindex/txindex.go | 27 +- .../grpcserver/protowire/messages.pb.go | 101 +++-- .../grpcserver/protowire/messages.proto | 2 + .../server/grpcserver/protowire/rpc.md | 33 ++ .../server/grpcserver/protowire/rpc.pb.go | 408 ++++++++++++------ .../server/grpcserver/protowire/rpc.proto | 14 +- .../rpc_get_accepting_block_hash_of_tx.go | 70 +++ .../server/grpcserver/protowire/wire.go | 14 + .../rpc_get_accepting_block_hash_of_tx.go | 20 + 14 files changed, 614 insertions(+), 188 deletions(-) create mode 100644 app/appmessage/rpc_get_accepting_block_hash_of_tx.go create mode 100644 app/rpc/rpchandlers/get_accepting_block_hash_of_tx.go create mode 100644 infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_accepting_block_hash_of_tx.go create mode 100644 infrastructure/network/rpcclient/rpc_get_accepting_block_hash_of_tx.go diff --git a/app/appmessage/message.go b/app/appmessage/message.go index 8f778b117..053b35c7e 100644 --- a/app/appmessage/message.go +++ b/app/appmessage/message.go @@ -163,6 +163,8 @@ const ( CmdGetMempoolEntriesByAddressesResponseMessage CmdGetCoinSupplyRequestMessage CmdGetCoinSupplyResponseMessage + CmdGetAcceptingBlockHashOfTxRequestMessage + CmdGetAcceptingBlockHashOfTxResponseMessage ) // ProtocolMessageCommandToString maps all MessageCommands to their string representation @@ -300,6 +302,8 @@ var RPCMessageCommandToString = map[MessageCommand]string{ CmdGetMempoolEntriesByAddressesResponseMessage: "GetMempoolEntriesByAddressesResponse", CmdGetCoinSupplyRequestMessage: "GetCoinSupplyRequest", CmdGetCoinSupplyResponseMessage: "GetCoinSupplyResponse", + CmdGetAcceptingBlockHashOfTxRequestMessage: "GetAcceptingBlockHashOfTxRequest", + CmdGetAcceptingBlockHashOfTxResponseMessage: "GetAcceptingBlockHashOfTxResponse", } // Message is an interface that describes a kaspa message. A type that diff --git a/app/appmessage/rpc_get_accepting_block_hash_of_tx.go b/app/appmessage/rpc_get_accepting_block_hash_of_tx.go new file mode 100644 index 000000000..4996befaf --- /dev/null +++ b/app/appmessage/rpc_get_accepting_block_hash_of_tx.go @@ -0,0 +1,41 @@ +package appmessage + +// GetAcceptingBlockHashOfTxRequestMessage is an appmessage corresponding to +// its respective RPC message +type GetAcceptingBlockHashOfTxRequestMessage struct { + baseMessage + TxID string +} + +// Command returns the protocol command string for the message +func (msg *GetAcceptingBlockHashOfTxRequestMessage) Command() MessageCommand { + return CmdGetAcceptingBlockHashOfTxRequestMessage +} + +// NewGetAcceptingBlockHashOfTxRequest returns a instance of the message +func NewGetAcceptingBlockHashOfTxRequest(txID string) *GetAcceptingBlockHashOfTxRequestMessage { + return &GetAcceptingBlockHashOfTxRequestMessage{ + TxID: txID, + } +} + +// GetAcceptingBlockHashOfTxResponseMessage is an appmessage corresponding to +// its respective RPC message +type GetAcceptingBlockHashOfTxResponseMessage struct { + baseMessage + Hash string + + Error *RPCError +} + +// Command returns the protocol command string for the message +func (msg *GetAcceptingBlockHashOfTxResponseMessage) Command() MessageCommand { + return CmdGetAcceptingBlockHashOfTxResponseMessage +} + +// NewGetAcceptingBlockHashOfTxResponse returns an instance of the message +func NewGetAcceptingBlockHashOfTxResponse(hash string) *GetAcceptingBlockHashOfTxResponseMessage { + return &GetAcceptingBlockHashOfTxResponseMessage{ + Hash: hash, + } +} diff --git a/app/rpc/rpc.go b/app/rpc/rpc.go index 770b9eb22..71acd8b6b 100644 --- a/app/rpc/rpc.go +++ b/app/rpc/rpc.go @@ -51,6 +51,7 @@ var handlers = map[appmessage.MessageCommand]handler{ appmessage.CmdNotifyNewBlockTemplateRequestMessage: rpchandlers.HandleNotifyNewBlockTemplate, appmessage.CmdGetCoinSupplyRequestMessage: rpchandlers.HandleGetCoinSupply, appmessage.CmdGetMempoolEntriesByAddressesRequestMessage: rpchandlers.HandleGetMempoolEntriesByAddresses, + appmessage.CmdGetAcceptingBlockHashOfTxRequestMessage: rpchandlers.HandleGetAcceptingBlockHashOfTx, } func (m *Manager) routerInitializer(router *router.Router, netConnection *netadapter.NetConnection) { diff --git a/app/rpc/rpchandlers/get_accepting_block_hash_of_tx.go b/app/rpc/rpchandlers/get_accepting_block_hash_of_tx.go new file mode 100644 index 000000000..c99ae135f --- /dev/null +++ b/app/rpc/rpchandlers/get_accepting_block_hash_of_tx.go @@ -0,0 +1,53 @@ +package rpchandlers + +import ( + "github.com/kaspanet/kaspad/app/appmessage" + "github.com/kaspanet/kaspad/app/rpc/rpccontext" + "github.com/kaspanet/kaspad/domain/consensus/model/externalapi" + "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router" + + "github.com/pkg/errors" +) + +// HandleGetAcceptingBlockHashOfTx handles the respectively named RPC command +func HandleGetAcceptingBlockHashOfTx(context *rpccontext.Context, _ *router.Router, request appmessage.Message) (appmessage.Message, error) { + if !context.Config.TXIndex { + errorMessage := &appmessage.GetAcceptingBlockHashOfTxResponseMessage{} + errorMessage.Error = appmessage.RPCErrorf("Method unavailable when kaspad is run without --txindex") + return errorMessage, nil + } + + getAcceptingBlockHashOfTxRequest := request.(*appmessage.GetAcceptingBlockHashOfTxRequestMessage) + + domainTxID, err := externalapi.NewDomainTransactionIDFromString(getAcceptingBlockHashOfTxRequest.TxID) + if err != nil { + rpcError := &appmessage.RPCError{} + if !errors.As(err, &rpcError) { + return nil, err + } + errorMessage := &appmessage.GetUTXOsByAddressesResponseMessage{} + errorMessage.Error = rpcError + return errorMessage, nil + } + + acceptingBlockHash, found, err := context.TXIndex.TXAcceptingBlockHash(domainTxID) + if err != nil { + rpcError := &appmessage.RPCError{} + if !errors.As(err, &rpcError) { + return nil, err + } + errorMessage := &appmessage.GetUTXOsByAddressesResponseMessage{} + errorMessage.Error = rpcError + return errorMessage, nil + } + if !found { + errorMessage := &appmessage.GetAcceptingBlockHashOfTxResponseMessage{} + errorMessage.Error = appmessage.RPCErrorf("Could not find accepting block hash in the txindex database for txID: %s", domainTxID.String()) + return errorMessage, nil + + } + + response := appmessage.NewGetAcceptingBlockHashOfTxResponse(acceptingBlockHash.String()) + + return response, nil +} diff --git a/domain/txindex/store.go b/domain/txindex/store.go index df229bb3a..4d233b094 100644 --- a/domain/txindex/store.go +++ b/domain/txindex/store.go @@ -199,23 +199,25 @@ func (tis *txIndexStore) isAnythingStaged() bool { return len(tis.toAdd) > 0 } -func (tis *txIndexStore) getTxAcceptingBlockHash(txID *externalapi.DomainTransactionID) (*externalapi.DomainHash, error) { +func (tis *txIndexStore) getTxAcceptingBlockHash(txID *externalapi.DomainTransactionID) (blockHash *externalapi.DomainHash, found bool, err error) { if tis.isAnythingStaged() { - return nil, errors.Errorf("cannot get TX accepting Block hash while staging isn't empty") + return nil, false, errors.Errorf("cannot get TX accepting Block hash while staging isn't empty") } key := tis.convertTxIDToKey(txAcceptedIndexBucket, *txID) serializedAcceptingBlockHash, err := tis.database.Get(key) - if err != nil { - return nil, err + if err == database.ErrNotFound { + return nil, false, nil + } + return nil, false, err } acceptingBlockHash, err := externalapi.NewDomainHashFromByteSlice(serializedAcceptingBlockHash) if err != nil { - return nil, err + return nil, false, err } - return acceptingBlockHash, nil + return acceptingBlockHash, true, nil } diff --git a/domain/txindex/txindex.go b/domain/txindex/txindex.go index ae8e752a1..ae4fcc639 100644 --- a/domain/txindex/txindex.go +++ b/domain/txindex/txindex.go @@ -179,37 +179,18 @@ func (ti *TXIndex) addTXIDs(selectedParentChainChanges *externalapi.SelectedChai } // TXAcceptingBlockHash returns the accepting block hash for for the given txID -func (ti *TXIndex) TXAcceptingBlockHash(txID *externalapi.DomainTransactionID) (*externalapi.DomainHash, error) { +func (ti *TXIndex) TXAcceptingBlockHash(txID *externalapi.DomainTransactionID) (blockHash *externalapi.DomainHash, found bool, err error) { onEnd := logger.LogAndMeasureExecutionTime(log, "TXIndex.TXAcceptingBlockHash") defer onEnd() ti.mutex.Lock() defer ti.mutex.Unlock() - acceptingBlockHash, err := ti.store.getTxAcceptingBlockHash(txID) + acceptingBlockHash, found, err := ti.store.getTxAcceptingBlockHash(txID) if err != nil { - return nil, err + return nil, false, err } - return acceptingBlockHash, nil -} - -// TXAcceptingBlock returns the accepting block for for the given txID -func (ti *TXIndex) TXAcceptingBlock(txID *externalapi.DomainTransactionID) (*externalapi.DomainBlock, error) { - onEnd := logger.LogAndMeasureExecutionTime(log, "TXIndex.TXAcceptingBlock") - defer onEnd() - - ti.mutex.Lock() - defer ti.mutex.Unlock() - - acceptingBlockHash, err := ti.store.getTxAcceptingBlockHash(txID) - if err != nil { - return nil, err - } - acceptingBlock, err := ti.domain.Consensus().GetBlock(acceptingBlockHash) - if err != nil { - return nil, err - } - return acceptingBlock, nil + return acceptingBlockHash, found, nil } //TO DO: Get Block from TxID diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/messages.pb.go b/infrastructure/network/netadapter/server/grpcserver/protowire/messages.pb.go index c273e10d7..056e7ba15 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/messages.pb.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/messages.pb.go @@ -156,6 +156,8 @@ type KaspadMessage struct { // *KaspadMessage_GetMempoolEntriesByAddressesResponse // *KaspadMessage_GetCoinSupplyRequest // *KaspadMessage_GetCoinSupplyResponse + // *KaspadMessage_GetAcceptingBlockHashOfTxRequest + // *KaspadMessage_GetAcceptingBlockHashOfTxResponse Payload isKaspadMessage_Payload `protobuf_oneof:"payload"` } @@ -1108,6 +1110,20 @@ func (x *KaspadMessage) GetGetCoinSupplyResponse() *GetCoinSupplyResponseMessage return nil } +func (x *KaspadMessage) GetGetAcceptingBlockHashOfTxRequest() *GetAcceptingBlockHashOfTxRequestMessage { + if x, ok := x.GetPayload().(*KaspadMessage_GetAcceptingBlockHashOfTxRequest); ok { + return x.GetAcceptingBlockHashOfTxRequest + } + return nil +} + +func (x *KaspadMessage) GetGetAcceptingBlockHashOfTxResponse() *GetAcceptingBlockHashOfTxResponseMessage { + if x, ok := x.GetPayload().(*KaspadMessage_GetAcceptingBlockHashOfTxResponse); ok { + return x.GetAcceptingBlockHashOfTxResponse + } + return nil +} + type isKaspadMessage_Payload interface { isKaspadMessage_Payload() } @@ -1632,6 +1648,14 @@ type KaspadMessage_GetCoinSupplyResponse struct { GetCoinSupplyResponse *GetCoinSupplyResponseMessage `protobuf:"bytes,1087,opt,name=getCoinSupplyResponse,proto3,oneof"` } +type KaspadMessage_GetAcceptingBlockHashOfTxRequest struct { + GetAcceptingBlockHashOfTxRequest *GetAcceptingBlockHashOfTxRequestMessage `protobuf:"bytes,1088,opt,name=getAcceptingBlockHashOfTxRequest,proto3,oneof"` +} + +type KaspadMessage_GetAcceptingBlockHashOfTxResponse struct { + GetAcceptingBlockHashOfTxResponse *GetAcceptingBlockHashOfTxResponseMessage `protobuf:"bytes,1089,opt,name=getAcceptingBlockHashOfTxResponse,proto3,oneof"` +} + func (*KaspadMessage_Addresses) isKaspadMessage_Payload() {} func (*KaspadMessage_Block) isKaspadMessage_Payload() {} @@ -1892,13 +1916,17 @@ func (*KaspadMessage_GetCoinSupplyRequest) isKaspadMessage_Payload() {} func (*KaspadMessage_GetCoinSupplyResponse) isKaspadMessage_Payload() {} +func (*KaspadMessage_GetAcceptingBlockHashOfTxRequest) isKaspadMessage_Payload() {} + +func (*KaspadMessage_GetAcceptingBlockHashOfTxResponse) isKaspadMessage_Payload() {} + var File_messages_proto protoreflect.FileDescriptor var file_messages_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x1a, 0x09, 0x70, 0x32, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x09, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xbf, 0x6d, 0x0a, 0x0d, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, + 0x6f, 0x22, 0xca, 0x6f, 0x0a, 0x0d, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3b, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73, @@ -2773,21 +2801,38 @@ var file_messages_proto_rawDesc = []byte{ 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x15, 0x67, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x32, 0x50, 0x0a, 0x03, 0x50, 0x32, 0x50, 0x12, 0x49, 0x0a, 0x0d, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, - 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0x00, 0x28, 0x01, 0x30, 0x01, 0x32, 0x50, 0x0a, 0x03, 0x52, 0x50, 0x43, 0x12, 0x49, 0x0a, 0x0d, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, - 0x69, 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x6b, - 0x61, 0x73, 0x70, 0x61, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x20, 0x67, 0x65, 0x74, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, + 0x73, 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0xc0, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x20, 0x67, 0x65, 0x74, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, + 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x84, 0x01, 0x0a, + 0x21, 0x67, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x18, 0xc1, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, + 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, + 0x52, 0x21, 0x67, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x66, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0x50, + 0x0a, 0x03, 0x50, 0x32, 0x50, 0x12, 0x49, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, + 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, + 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, + 0x32, 0x50, 0x0a, 0x03, 0x52, 0x50, 0x43, 0x12, 0x49, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4b, + 0x61, 0x73, 0x70, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, + 0x30, 0x01, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -2934,6 +2979,8 @@ var file_messages_proto_goTypes = []interface{}{ (*GetMempoolEntriesByAddressesResponseMessage)(nil), // 127: protowire.GetMempoolEntriesByAddressesResponseMessage (*GetCoinSupplyRequestMessage)(nil), // 128: protowire.GetCoinSupplyRequestMessage (*GetCoinSupplyResponseMessage)(nil), // 129: protowire.GetCoinSupplyResponseMessage + (*GetAcceptingBlockHashOfTxRequestMessage)(nil), // 130: protowire.GetAcceptingBlockHashOfTxRequestMessage + (*GetAcceptingBlockHashOfTxResponseMessage)(nil), // 131: protowire.GetAcceptingBlockHashOfTxResponseMessage } var file_messages_proto_depIdxs = []int32{ 1, // 0: protowire.KaspadMessage.addresses:type_name -> protowire.AddressesMessage @@ -3066,15 +3113,17 @@ var file_messages_proto_depIdxs = []int32{ 127, // 127: protowire.KaspadMessage.getMempoolEntriesByAddressesResponse:type_name -> protowire.GetMempoolEntriesByAddressesResponseMessage 128, // 128: protowire.KaspadMessage.getCoinSupplyRequest:type_name -> protowire.GetCoinSupplyRequestMessage 129, // 129: protowire.KaspadMessage.getCoinSupplyResponse:type_name -> protowire.GetCoinSupplyResponseMessage - 0, // 130: protowire.P2P.MessageStream:input_type -> protowire.KaspadMessage - 0, // 131: protowire.RPC.MessageStream:input_type -> protowire.KaspadMessage - 0, // 132: protowire.P2P.MessageStream:output_type -> protowire.KaspadMessage - 0, // 133: protowire.RPC.MessageStream:output_type -> protowire.KaspadMessage - 132, // [132:134] is the sub-list for method output_type - 130, // [130:132] is the sub-list for method input_type - 130, // [130:130] is the sub-list for extension type_name - 130, // [130:130] is the sub-list for extension extendee - 0, // [0:130] is the sub-list for field type_name + 130, // 130: protowire.KaspadMessage.getAcceptingBlockHashOfTxRequest:type_name -> protowire.GetAcceptingBlockHashOfTxRequestMessage + 131, // 131: protowire.KaspadMessage.getAcceptingBlockHashOfTxResponse:type_name -> protowire.GetAcceptingBlockHashOfTxResponseMessage + 0, // 132: protowire.P2P.MessageStream:input_type -> protowire.KaspadMessage + 0, // 133: protowire.RPC.MessageStream:input_type -> protowire.KaspadMessage + 0, // 134: protowire.P2P.MessageStream:output_type -> protowire.KaspadMessage + 0, // 135: protowire.RPC.MessageStream:output_type -> protowire.KaspadMessage + 134, // [134:136] is the sub-list for method output_type + 132, // [132:134] is the sub-list for method input_type + 132, // [132:132] is the sub-list for extension type_name + 132, // [132:132] is the sub-list for extension extendee + 0, // [0:132] is the sub-list for field type_name } func init() { file_messages_proto_init() } @@ -3229,6 +3278,8 @@ func file_messages_proto_init() { (*KaspadMessage_GetMempoolEntriesByAddressesResponse)(nil), (*KaspadMessage_GetCoinSupplyRequest)(nil), (*KaspadMessage_GetCoinSupplyResponse)(nil), + (*KaspadMessage_GetAcceptingBlockHashOfTxRequest)(nil), + (*KaspadMessage_GetAcceptingBlockHashOfTxResponse)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/messages.proto b/infrastructure/network/netadapter/server/grpcserver/protowire/messages.proto index 50be89138..3e70ca36b 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/messages.proto +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/messages.proto @@ -139,6 +139,8 @@ message KaspadMessage { GetMempoolEntriesByAddressesResponseMessage getMempoolEntriesByAddressesResponse = 1085; GetCoinSupplyRequestMessage getCoinSupplyRequest = 1086; GetCoinSupplyResponseMessage getCoinSupplyResponse= 1087; + GetAcceptingBlockHashOfTxRequestMessage getAcceptingBlockHashOfTxRequest = 1088; + GetAcceptingBlockHashOfTxResponseMessage getAcceptingBlockHashOfTxResponse = 1089; } } diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md index 12a22923c..542dd6d2e 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.md @@ -102,6 +102,8 @@ - [UnbanResponseMessage](#protowire.UnbanResponseMessage) - [GetInfoRequestMessage](#protowire.GetInfoRequestMessage) - [GetInfoResponseMessage](#protowire.GetInfoResponseMessage) + - [GetAcceptingBlockHashOfTxRequestMessage](#protowire.GetAcceptingBlockHashOfTxRequestMessage) + - [GetAcceptingBlockHashOfTxResponseMessage](#protowire.GetAcceptingBlockHashOfTxResponseMessage) - [EstimateNetworkHashesPerSecondRequestMessage](#protowire.EstimateNetworkHashesPerSecondRequestMessage) - [EstimateNetworkHashesPerSecondResponseMessage](#protowire.EstimateNetworkHashesPerSecondResponseMessage) - [NotifyNewBlockTemplateRequestMessage](#protowire.NotifyNewBlockTemplateRequestMessage) @@ -1708,6 +1710,37 @@ GetInfoRequestMessage returns info about the node. + + +### GetAcceptingBlockHashOfTxRequestMessage +Kaspad most be started with the `--txindex` flag for this Request to work. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| txID | [string](#string) | | | + + + + + + + + +### GetAcceptingBlockHashOfTxResponseMessage +the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| hash | [string](#string) | | the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG | +| error | [RPCError](#protowire.RPCError) | | | + + + + + + ### EstimateNetworkHashesPerSecondRequestMessage diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go index a72e70fe4..b1d3ef8c4 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.pb.go @@ -5588,6 +5588,110 @@ func (x *GetInfoResponseMessage) GetError() *RPCError { return nil } +//Kaspad most be started with the `--txindex` flag for this Request to work. +type GetAcceptingBlockHashOfTxRequestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TxID string `protobuf:"bytes,1,opt,name=txID,proto3" json:"txID,omitempty"` +} + +func (x *GetAcceptingBlockHashOfTxRequestMessage) Reset() { + *x = GetAcceptingBlockHashOfTxRequestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_proto_msgTypes[98] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAcceptingBlockHashOfTxRequestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAcceptingBlockHashOfTxRequestMessage) ProtoMessage() {} + +func (x *GetAcceptingBlockHashOfTxRequestMessage) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[98] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAcceptingBlockHashOfTxRequestMessage.ProtoReflect.Descriptor instead. +func (*GetAcceptingBlockHashOfTxRequestMessage) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{98} +} + +func (x *GetAcceptingBlockHashOfTxRequestMessage) GetTxID() string { + if x != nil { + return x.TxID + } + return "" +} + +//the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG +type GetAcceptingBlockHashOfTxResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` //the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG + Error *RPCError `protobuf:"bytes,1000,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) Reset() { + *x = GetAcceptingBlockHashOfTxResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_proto_msgTypes[99] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAcceptingBlockHashOfTxResponseMessage) ProtoMessage() {} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_rpc_proto_msgTypes[99] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAcceptingBlockHashOfTxResponseMessage.ProtoReflect.Descriptor instead. +func (*GetAcceptingBlockHashOfTxResponseMessage) Descriptor() ([]byte, []int) { + return file_rpc_proto_rawDescGZIP(), []int{99} +} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) GetError() *RPCError { + if x != nil { + return x.Error + } + return nil +} + type EstimateNetworkHashesPerSecondRequestMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -5600,7 +5704,7 @@ type EstimateNetworkHashesPerSecondRequestMessage struct { func (x *EstimateNetworkHashesPerSecondRequestMessage) Reset() { *x = EstimateNetworkHashesPerSecondRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[98] + mi := &file_rpc_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5613,7 +5717,7 @@ func (x *EstimateNetworkHashesPerSecondRequestMessage) String() string { func (*EstimateNetworkHashesPerSecondRequestMessage) ProtoMessage() {} func (x *EstimateNetworkHashesPerSecondRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[98] + mi := &file_rpc_proto_msgTypes[100] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5626,7 +5730,7 @@ func (x *EstimateNetworkHashesPerSecondRequestMessage) ProtoReflect() protorefle // Deprecated: Use EstimateNetworkHashesPerSecondRequestMessage.ProtoReflect.Descriptor instead. func (*EstimateNetworkHashesPerSecondRequestMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{98} + return file_rpc_proto_rawDescGZIP(), []int{100} } func (x *EstimateNetworkHashesPerSecondRequestMessage) GetWindowSize() uint32 { @@ -5655,7 +5759,7 @@ type EstimateNetworkHashesPerSecondResponseMessage struct { func (x *EstimateNetworkHashesPerSecondResponseMessage) Reset() { *x = EstimateNetworkHashesPerSecondResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[99] + mi := &file_rpc_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5668,7 +5772,7 @@ func (x *EstimateNetworkHashesPerSecondResponseMessage) String() string { func (*EstimateNetworkHashesPerSecondResponseMessage) ProtoMessage() {} func (x *EstimateNetworkHashesPerSecondResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[99] + mi := &file_rpc_proto_msgTypes[101] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5681,7 +5785,7 @@ func (x *EstimateNetworkHashesPerSecondResponseMessage) ProtoReflect() protorefl // Deprecated: Use EstimateNetworkHashesPerSecondResponseMessage.ProtoReflect.Descriptor instead. func (*EstimateNetworkHashesPerSecondResponseMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{99} + return file_rpc_proto_rawDescGZIP(), []int{101} } func (x *EstimateNetworkHashesPerSecondResponseMessage) GetNetworkHashesPerSecond() uint64 { @@ -5711,7 +5815,7 @@ type NotifyNewBlockTemplateRequestMessage struct { func (x *NotifyNewBlockTemplateRequestMessage) Reset() { *x = NotifyNewBlockTemplateRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[100] + mi := &file_rpc_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5724,7 +5828,7 @@ func (x *NotifyNewBlockTemplateRequestMessage) String() string { func (*NotifyNewBlockTemplateRequestMessage) ProtoMessage() {} func (x *NotifyNewBlockTemplateRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[100] + mi := &file_rpc_proto_msgTypes[102] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5737,7 +5841,7 @@ func (x *NotifyNewBlockTemplateRequestMessage) ProtoReflect() protoreflect.Messa // Deprecated: Use NotifyNewBlockTemplateRequestMessage.ProtoReflect.Descriptor instead. func (*NotifyNewBlockTemplateRequestMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{100} + return file_rpc_proto_rawDescGZIP(), []int{102} } type NotifyNewBlockTemplateResponseMessage struct { @@ -5751,7 +5855,7 @@ type NotifyNewBlockTemplateResponseMessage struct { func (x *NotifyNewBlockTemplateResponseMessage) Reset() { *x = NotifyNewBlockTemplateResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[101] + mi := &file_rpc_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5764,7 +5868,7 @@ func (x *NotifyNewBlockTemplateResponseMessage) String() string { func (*NotifyNewBlockTemplateResponseMessage) ProtoMessage() {} func (x *NotifyNewBlockTemplateResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[101] + mi := &file_rpc_proto_msgTypes[103] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5777,7 +5881,7 @@ func (x *NotifyNewBlockTemplateResponseMessage) ProtoReflect() protoreflect.Mess // Deprecated: Use NotifyNewBlockTemplateResponseMessage.ProtoReflect.Descriptor instead. func (*NotifyNewBlockTemplateResponseMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{101} + return file_rpc_proto_rawDescGZIP(), []int{103} } func (x *NotifyNewBlockTemplateResponseMessage) GetError() *RPCError { @@ -5800,7 +5904,7 @@ type NewBlockTemplateNotificationMessage struct { func (x *NewBlockTemplateNotificationMessage) Reset() { *x = NewBlockTemplateNotificationMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[102] + mi := &file_rpc_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5813,7 +5917,7 @@ func (x *NewBlockTemplateNotificationMessage) String() string { func (*NewBlockTemplateNotificationMessage) ProtoMessage() {} func (x *NewBlockTemplateNotificationMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[102] + mi := &file_rpc_proto_msgTypes[104] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5826,7 +5930,7 @@ func (x *NewBlockTemplateNotificationMessage) ProtoReflect() protoreflect.Messag // Deprecated: Use NewBlockTemplateNotificationMessage.ProtoReflect.Descriptor instead. func (*NewBlockTemplateNotificationMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{102} + return file_rpc_proto_rawDescGZIP(), []int{104} } type MempoolEntryByAddress struct { @@ -5842,7 +5946,7 @@ type MempoolEntryByAddress struct { func (x *MempoolEntryByAddress) Reset() { *x = MempoolEntryByAddress{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[103] + mi := &file_rpc_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5855,7 +5959,7 @@ func (x *MempoolEntryByAddress) String() string { func (*MempoolEntryByAddress) ProtoMessage() {} func (x *MempoolEntryByAddress) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[103] + mi := &file_rpc_proto_msgTypes[105] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5868,7 +5972,7 @@ func (x *MempoolEntryByAddress) ProtoReflect() protoreflect.Message { // Deprecated: Use MempoolEntryByAddress.ProtoReflect.Descriptor instead. func (*MempoolEntryByAddress) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{103} + return file_rpc_proto_rawDescGZIP(), []int{105} } func (x *MempoolEntryByAddress) GetAddress() string { @@ -5905,7 +6009,7 @@ type GetMempoolEntriesByAddressesRequestMessage struct { func (x *GetMempoolEntriesByAddressesRequestMessage) Reset() { *x = GetMempoolEntriesByAddressesRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[104] + mi := &file_rpc_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5918,7 +6022,7 @@ func (x *GetMempoolEntriesByAddressesRequestMessage) String() string { func (*GetMempoolEntriesByAddressesRequestMessage) ProtoMessage() {} func (x *GetMempoolEntriesByAddressesRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[104] + mi := &file_rpc_proto_msgTypes[106] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5931,7 +6035,7 @@ func (x *GetMempoolEntriesByAddressesRequestMessage) ProtoReflect() protoreflect // Deprecated: Use GetMempoolEntriesByAddressesRequestMessage.ProtoReflect.Descriptor instead. func (*GetMempoolEntriesByAddressesRequestMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{104} + return file_rpc_proto_rawDescGZIP(), []int{106} } func (x *GetMempoolEntriesByAddressesRequestMessage) GetAddresses() []string { @@ -5967,7 +6071,7 @@ type GetMempoolEntriesByAddressesResponseMessage struct { func (x *GetMempoolEntriesByAddressesResponseMessage) Reset() { *x = GetMempoolEntriesByAddressesResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[105] + mi := &file_rpc_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5980,7 +6084,7 @@ func (x *GetMempoolEntriesByAddressesResponseMessage) String() string { func (*GetMempoolEntriesByAddressesResponseMessage) ProtoMessage() {} func (x *GetMempoolEntriesByAddressesResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[105] + mi := &file_rpc_proto_msgTypes[107] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5993,7 +6097,7 @@ func (x *GetMempoolEntriesByAddressesResponseMessage) ProtoReflect() protoreflec // Deprecated: Use GetMempoolEntriesByAddressesResponseMessage.ProtoReflect.Descriptor instead. func (*GetMempoolEntriesByAddressesResponseMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{105} + return file_rpc_proto_rawDescGZIP(), []int{107} } func (x *GetMempoolEntriesByAddressesResponseMessage) GetEntries() []*MempoolEntryByAddress { @@ -6019,7 +6123,7 @@ type GetCoinSupplyRequestMessage struct { func (x *GetCoinSupplyRequestMessage) Reset() { *x = GetCoinSupplyRequestMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[106] + mi := &file_rpc_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6032,7 +6136,7 @@ func (x *GetCoinSupplyRequestMessage) String() string { func (*GetCoinSupplyRequestMessage) ProtoMessage() {} func (x *GetCoinSupplyRequestMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[106] + mi := &file_rpc_proto_msgTypes[108] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6045,7 +6149,7 @@ func (x *GetCoinSupplyRequestMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCoinSupplyRequestMessage.ProtoReflect.Descriptor instead. func (*GetCoinSupplyRequestMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{106} + return file_rpc_proto_rawDescGZIP(), []int{108} } type GetCoinSupplyResponseMessage struct { @@ -6061,7 +6165,7 @@ type GetCoinSupplyResponseMessage struct { func (x *GetCoinSupplyResponseMessage) Reset() { *x = GetCoinSupplyResponseMessage{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_proto_msgTypes[107] + mi := &file_rpc_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6074,7 +6178,7 @@ func (x *GetCoinSupplyResponseMessage) String() string { func (*GetCoinSupplyResponseMessage) ProtoMessage() {} func (x *GetCoinSupplyResponseMessage) ProtoReflect() protoreflect.Message { - mi := &file_rpc_proto_msgTypes[107] + mi := &file_rpc_proto_msgTypes[109] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6087,7 +6191,7 @@ func (x *GetCoinSupplyResponseMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCoinSupplyResponseMessage.ProtoReflect.Descriptor instead. func (*GetCoinSupplyResponseMessage) Descriptor() ([]byte, []int) { - return file_rpc_proto_rawDescGZIP(), []int{107} + return file_rpc_proto_rawDescGZIP(), []int{109} } func (x *GetCoinSupplyResponseMessage) GetMaxSompi() uint64 { @@ -6846,78 +6950,89 @@ var file_rpc_proto_rawDesc = []byte{ 0x52, 0x08, 0x69, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, - 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, - 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, - 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, - 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x48, 0x61, 0x73, 0x68, 0x22, 0x93, 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, - 0x65, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, - 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, - 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, - 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0x53, 0x0a, 0x25, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, - 0x01, 0x0a, 0x15, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, - 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, - 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, - 0x2a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, - 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, - 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, - 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, - 0x0a, 0x2b, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, - 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, - 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, - 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3d, 0x0a, 0x27, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, + 0x65, 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, + 0x66, 0x54, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x78, 0x49, 0x44, 0x22, 0x6a, 0x0a, 0x28, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, + 0x70, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x4f, 0x66, + 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, + 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0x6c, 0x0a, 0x2c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, + 0x93, 0x01, 0x0a, 0x2d, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x36, 0x0a, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, + 0x65, 0x73, 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x16, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x65, 0x73, + 0x50, 0x65, 0x72, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, - 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, - 0x69, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, - 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, - 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, - 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x26, 0x0a, 0x24, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, + 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x53, 0x0a, + 0x25, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, + 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x25, 0x0a, 0x23, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x15, 0x4d, 0x65, + 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31, 0x0a, + 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, + 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, + 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x72, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x22, 0xae, 0x01, 0x0a, 0x2a, 0x47, 0x65, 0x74, 0x4d, + 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, + 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x11, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4f, 0x72, 0x70, 0x68, 0x61, 0x6e, 0x50, 0x6f, + 0x6f, 0x6c, 0x12, 0x34, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x15, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x2b, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, 0x79, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, + 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x6d, 0x70, 0x6f, 0x6f, 0x6c, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x65, 0x6e, 0x74, + 0x72, 0x69, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0xe8, 0x07, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, + 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x22, 0x1d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, + 0x92, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x69, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x10, + 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x69, 0x72, 0x63, 0x75, 0x6c, 0x61, 0x74, + 0x69, 0x6e, 0x67, 0x53, 0x6f, 0x6d, 0x70, 0x69, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0xe8, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x77, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x50, 0x43, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x61, 0x73, 0x70, + 0x61, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x77, 0x69, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -6933,7 +7048,7 @@ func file_rpc_proto_rawDescGZIP() []byte { } var file_rpc_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 108) +var file_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 110) var file_rpc_proto_goTypes = []interface{}{ (SubmitBlockResponseMessage_RejectReason)(0), // 0: protowire.SubmitBlockResponseMessage.RejectReason (*RPCError)(nil), // 1: protowire.RPCError @@ -7034,16 +7149,18 @@ var file_rpc_proto_goTypes = []interface{}{ (*UnbanResponseMessage)(nil), // 96: protowire.UnbanResponseMessage (*GetInfoRequestMessage)(nil), // 97: protowire.GetInfoRequestMessage (*GetInfoResponseMessage)(nil), // 98: protowire.GetInfoResponseMessage - (*EstimateNetworkHashesPerSecondRequestMessage)(nil), // 99: protowire.EstimateNetworkHashesPerSecondRequestMessage - (*EstimateNetworkHashesPerSecondResponseMessage)(nil), // 100: protowire.EstimateNetworkHashesPerSecondResponseMessage - (*NotifyNewBlockTemplateRequestMessage)(nil), // 101: protowire.NotifyNewBlockTemplateRequestMessage - (*NotifyNewBlockTemplateResponseMessage)(nil), // 102: protowire.NotifyNewBlockTemplateResponseMessage - (*NewBlockTemplateNotificationMessage)(nil), // 103: protowire.NewBlockTemplateNotificationMessage - (*MempoolEntryByAddress)(nil), // 104: protowire.MempoolEntryByAddress - (*GetMempoolEntriesByAddressesRequestMessage)(nil), // 105: protowire.GetMempoolEntriesByAddressesRequestMessage - (*GetMempoolEntriesByAddressesResponseMessage)(nil), // 106: protowire.GetMempoolEntriesByAddressesResponseMessage - (*GetCoinSupplyRequestMessage)(nil), // 107: protowire.GetCoinSupplyRequestMessage - (*GetCoinSupplyResponseMessage)(nil), // 108: protowire.GetCoinSupplyResponseMessage + (*GetAcceptingBlockHashOfTxRequestMessage)(nil), // 99: protowire.GetAcceptingBlockHashOfTxRequestMessage + (*GetAcceptingBlockHashOfTxResponseMessage)(nil), // 100: protowire.GetAcceptingBlockHashOfTxResponseMessage + (*EstimateNetworkHashesPerSecondRequestMessage)(nil), // 101: protowire.EstimateNetworkHashesPerSecondRequestMessage + (*EstimateNetworkHashesPerSecondResponseMessage)(nil), // 102: protowire.EstimateNetworkHashesPerSecondResponseMessage + (*NotifyNewBlockTemplateRequestMessage)(nil), // 103: protowire.NotifyNewBlockTemplateRequestMessage + (*NotifyNewBlockTemplateResponseMessage)(nil), // 104: protowire.NotifyNewBlockTemplateResponseMessage + (*NewBlockTemplateNotificationMessage)(nil), // 105: protowire.NewBlockTemplateNotificationMessage + (*MempoolEntryByAddress)(nil), // 106: protowire.MempoolEntryByAddress + (*GetMempoolEntriesByAddressesRequestMessage)(nil), // 107: protowire.GetMempoolEntriesByAddressesRequestMessage + (*GetMempoolEntriesByAddressesResponseMessage)(nil), // 108: protowire.GetMempoolEntriesByAddressesResponseMessage + (*GetCoinSupplyRequestMessage)(nil), // 109: protowire.GetCoinSupplyRequestMessage + (*GetCoinSupplyResponseMessage)(nil), // 110: protowire.GetCoinSupplyResponseMessage } var file_rpc_proto_depIdxs = []int32{ 3, // 0: protowire.RpcBlock.header:type_name -> protowire.RpcBlockHeader @@ -7115,18 +7232,19 @@ var file_rpc_proto_depIdxs = []int32{ 1, // 66: protowire.BanResponseMessage.error:type_name -> protowire.RPCError 1, // 67: protowire.UnbanResponseMessage.error:type_name -> protowire.RPCError 1, // 68: protowire.GetInfoResponseMessage.error:type_name -> protowire.RPCError - 1, // 69: protowire.EstimateNetworkHashesPerSecondResponseMessage.error:type_name -> protowire.RPCError - 1, // 70: protowire.NotifyNewBlockTemplateResponseMessage.error:type_name -> protowire.RPCError - 33, // 71: protowire.MempoolEntryByAddress.sending:type_name -> protowire.MempoolEntry - 33, // 72: protowire.MempoolEntryByAddress.receiving:type_name -> protowire.MempoolEntry - 104, // 73: protowire.GetMempoolEntriesByAddressesResponseMessage.entries:type_name -> protowire.MempoolEntryByAddress - 1, // 74: protowire.GetMempoolEntriesByAddressesResponseMessage.error:type_name -> protowire.RPCError - 1, // 75: protowire.GetCoinSupplyResponseMessage.error:type_name -> protowire.RPCError - 76, // [76:76] is the sub-list for method output_type - 76, // [76:76] is the sub-list for method input_type - 76, // [76:76] is the sub-list for extension type_name - 76, // [76:76] is the sub-list for extension extendee - 0, // [0:76] is the sub-list for field type_name + 1, // 69: protowire.GetAcceptingBlockHashOfTxResponseMessage.error:type_name -> protowire.RPCError + 1, // 70: protowire.EstimateNetworkHashesPerSecondResponseMessage.error:type_name -> protowire.RPCError + 1, // 71: protowire.NotifyNewBlockTemplateResponseMessage.error:type_name -> protowire.RPCError + 33, // 72: protowire.MempoolEntryByAddress.sending:type_name -> protowire.MempoolEntry + 33, // 73: protowire.MempoolEntryByAddress.receiving:type_name -> protowire.MempoolEntry + 106, // 74: protowire.GetMempoolEntriesByAddressesResponseMessage.entries:type_name -> protowire.MempoolEntryByAddress + 1, // 75: protowire.GetMempoolEntriesByAddressesResponseMessage.error:type_name -> protowire.RPCError + 1, // 76: protowire.GetCoinSupplyResponseMessage.error:type_name -> protowire.RPCError + 77, // [77:77] is the sub-list for method output_type + 77, // [77:77] is the sub-list for method input_type + 77, // [77:77] is the sub-list for extension type_name + 77, // [77:77] is the sub-list for extension extendee + 0, // [0:77] is the sub-list for field type_name } func init() { file_rpc_proto_init() } @@ -8312,7 +8430,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[98].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EstimateNetworkHashesPerSecondRequestMessage); i { + switch v := v.(*GetAcceptingBlockHashOfTxRequestMessage); i { case 0: return &v.state case 1: @@ -8324,7 +8442,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[99].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EstimateNetworkHashesPerSecondResponseMessage); i { + switch v := v.(*GetAcceptingBlockHashOfTxResponseMessage); i { case 0: return &v.state case 1: @@ -8336,7 +8454,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[100].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NotifyNewBlockTemplateRequestMessage); i { + switch v := v.(*EstimateNetworkHashesPerSecondRequestMessage); i { case 0: return &v.state case 1: @@ -8348,7 +8466,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[101].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NotifyNewBlockTemplateResponseMessage); i { + switch v := v.(*EstimateNetworkHashesPerSecondResponseMessage); i { case 0: return &v.state case 1: @@ -8360,7 +8478,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[102].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewBlockTemplateNotificationMessage); i { + switch v := v.(*NotifyNewBlockTemplateRequestMessage); i { case 0: return &v.state case 1: @@ -8372,7 +8490,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[103].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MempoolEntryByAddress); i { + switch v := v.(*NotifyNewBlockTemplateResponseMessage); i { case 0: return &v.state case 1: @@ -8384,7 +8502,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[104].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMempoolEntriesByAddressesRequestMessage); i { + switch v := v.(*NewBlockTemplateNotificationMessage); i { case 0: return &v.state case 1: @@ -8396,7 +8514,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[105].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMempoolEntriesByAddressesResponseMessage); i { + switch v := v.(*MempoolEntryByAddress); i { case 0: return &v.state case 1: @@ -8408,7 +8526,7 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[106].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCoinSupplyRequestMessage); i { + switch v := v.(*GetMempoolEntriesByAddressesRequestMessage); i { case 0: return &v.state case 1: @@ -8420,6 +8538,30 @@ func file_rpc_proto_init() { } } file_rpc_proto_msgTypes[107].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMempoolEntriesByAddressesResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_proto_msgTypes[108].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCoinSupplyRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rpc_proto_msgTypes[109].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetCoinSupplyResponseMessage); i { case 0: return &v.state @@ -8438,7 +8580,7 @@ func file_rpc_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rpc_proto_rawDesc, NumEnums: 1, - NumMessages: 108, + NumMessages: 110, NumExtensions: 0, NumServices: 0, }, diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto index 81919c954..2e0a05c51 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc.proto @@ -666,6 +666,18 @@ message GetInfoResponseMessage{ RPCError error = 1000; } + +//Kaspad most be started with the `--txindex` flag for this Request to work. +message GetAcceptingBlockHashOfTxRequestMessage { + string txID = 1; +} + + //the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG +message GetAcceptingBlockHashOfTxResponseMessage { + string hash = 1; //the accepting block is defined as the virtual chain block that first knows about the transaction. This block may change, or be ommitted and resubmitted, during virtual changes at the tip of the blockDAG + RPCError error = 1000; +} + message EstimateNetworkHashesPerSecondRequestMessage{ uint32 windowSize = 1; string startHash = 2; @@ -706,7 +718,7 @@ message GetMempoolEntriesByAddressesRequestMessage{ bool filterTransactionPool = 3; } -message GetMempoolEntriesByAddressesResponseMessage{ +message GetMempoolEntriesByAddressesResponseMessage{ repeated MempoolEntryByAddress entries = 1; RPCError error = 1000; diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_accepting_block_hash_of_tx.go b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_accepting_block_hash_of_tx.go new file mode 100644 index 000000000..426394780 --- /dev/null +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/rpc_get_accepting_block_hash_of_tx.go @@ -0,0 +1,70 @@ +package protowire + +import ( + "github.com/kaspanet/kaspad/app/appmessage" + "github.com/pkg/errors" +) + +func (x *KaspadMessage_GetAcceptingBlockHashOfTxRequest) toAppMessage() (appmessage.Message, error) { + if x == nil { + return nil, errors.Wrapf(errorNil, "KaspadMessage_GetAcceptingBlockHashOfTxRequest") + } + return x.GetAcceptingBlockHashOfTxRequest.toAppMessage() +} + +func (x *KaspadMessage_GetAcceptingBlockHashOfTxRequest) fromAppMessage(message *appmessage.GetAcceptingBlockHashOfTxRequestMessage) error { + x.GetAcceptingBlockHashOfTxRequest = &GetAcceptingBlockHashOfTxRequestMessage{ + TxID: message.TxID, + } + return nil +} + +func (x *GetAcceptingBlockHashOfTxRequestMessage) toAppMessage() (appmessage.Message, error) { + if x == nil { + return nil, errors.Wrapf(errorNil, "GetAcceptingBlockHashOfTxRequestMessage is nil") + } + return &appmessage.GetAcceptingBlockHashOfTxRequestMessage{ + TxID: x.TxID, + }, nil +} + +func (x *KaspadMessage_GetAcceptingBlockHashOfTxResponse) toAppMessage() (appmessage.Message, error) { + + if x == nil { + return nil, errors.Wrapf(errorNil, "KaspadMessage_GetAcceptingBlockHashOfTxResponse is nil") + } + return x.GetAcceptingBlockHashOfTxResponse.toAppMessage() +} + +func (x *KaspadMessage_GetAcceptingBlockHashOfTxResponse) fromAppMessage(message *appmessage.GetAcceptingBlockHashOfTxResponseMessage) error { + var err *RPCError + if message.Error != nil { + err = &RPCError{Message: message.Error.Message} + } + x.GetAcceptingBlockHashOfTxResponse = &GetAcceptingBlockHashOfTxResponseMessage{ + Hash: message.Hash, + + Error: err, + } + return nil +} + +func (x *GetAcceptingBlockHashOfTxResponseMessage) toAppMessage() (appmessage.Message, error) { + if x == nil { + return nil, errors.Wrapf(errorNil, "GetAcceptingBlockHashOfTxResponseMessage is nil") + } + rpcErr, err := x.Error.toAppMessage() + // Error is an optional field + if err != nil && !errors.Is(err, errorNil) { + return nil, err + } + + if rpcErr != nil && x.Hash != "" { + return nil, errors.New("GetAcceptingBlockHashOfTxResponseMessage contains both an error and a response") + } + + return &appmessage.GetAcceptingBlockHashOfTxResponseMessage{ + Hash: x.Hash, + Error: rpcErr, + }, nil +} diff --git a/infrastructure/network/netadapter/server/grpcserver/protowire/wire.go b/infrastructure/network/netadapter/server/grpcserver/protowire/wire.go index 30dd18b6e..4d92fe79c 100644 --- a/infrastructure/network/netadapter/server/grpcserver/protowire/wire.go +++ b/infrastructure/network/netadapter/server/grpcserver/protowire/wire.go @@ -968,6 +968,20 @@ func toRPCPayload(message appmessage.Message) (isKaspadMessage_Payload, error) { return nil, err } return payload, nil + case *appmessage.GetAcceptingBlockHashOfTxRequestMessage: + payload := new(KaspadMessage_GetAcceptingBlockHashOfTxRequest) + err := payload.fromAppMessage(message) + if err != nil { + return nil, err + } + return payload, nil + case *appmessage.GetAcceptingBlockHashOfTxResponseMessage: + payload := new(KaspadMessage_GetAcceptingBlockHashOfTxResponse) + err := payload.fromAppMessage(message) + if err != nil { + return nil, err + } + return payload, nil default: return nil, nil } diff --git a/infrastructure/network/rpcclient/rpc_get_accepting_block_hash_of_tx.go b/infrastructure/network/rpcclient/rpc_get_accepting_block_hash_of_tx.go new file mode 100644 index 000000000..577764d60 --- /dev/null +++ b/infrastructure/network/rpcclient/rpc_get_accepting_block_hash_of_tx.go @@ -0,0 +1,20 @@ +package rpcclient + +import "github.com/kaspanet/kaspad/app/appmessage" + +// GetAcceptingBlockHashOfTx sends an RPC request respective to the function's name and returns the RPC server's response +func (c *RPCClient) GetAcceptingBlockHashOfTx(txID string) (*appmessage.GetAcceptingBlockHashOfTxResponseMessage, error) { + err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewGetAcceptingBlockHashOfTxRequest(txID)) + if err != nil { + return nil, err + } + response, err := c.route(appmessage.CmdGetAcceptingBlockHashOfTxResponseMessage).DequeueWithTimeout(c.timeout) + if err != nil { + return nil, err + } + getAcceptingBlockHashOfTxResponse := response.(*appmessage.GetAcceptingBlockHashOfTxResponseMessage) + if getAcceptingBlockHashOfTxResponse.Error != nil { + return nil, c.convertRPCError(getAcceptingBlockHashOfTxResponse.Error) + } + return getAcceptingBlockHashOfTxResponse, nil +}