diff --git a/app/protocol/flows/blockrelay/handle_ibd_block_requests.go b/app/protocol/flows/blockrelay/handle_ibd_block_requests.go index e70e49eee..e6593dc7c 100644 --- a/app/protocol/flows/blockrelay/handle_ibd_block_requests.go +++ b/app/protocol/flows/blockrelay/handle_ibd_block_requests.go @@ -25,7 +25,8 @@ func HandleIBDBlockRequests(context HandleIBDBlockRequestsContext, incomingRoute return err } msgRequestIBDBlocks := message.(*appmessage.MsgRequestIBDBlocks) - for _, hash := range msgRequestIBDBlocks.Hashes { + log.Debugf("Got request for %d ibd blocks", len(msgRequestIBDBlocks.Hashes)) + for i, hash := range msgRequestIBDBlocks.Hashes { // Fetch the block from the database. blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash) if err != nil { @@ -47,6 +48,7 @@ func HandleIBDBlockRequests(context HandleIBDBlockRequestsContext, incomingRoute if err != nil { return err } + log.Debugf("sent %d out of %d", i, len(msgRequestIBDBlocks.Hashes)) } } } diff --git a/app/protocol/flows/blockrelay/handle_ibd_root_hash_requests.go b/app/protocol/flows/blockrelay/handle_ibd_root_hash_requests.go index 3d8948233..1250560f7 100644 --- a/app/protocol/flows/blockrelay/handle_ibd_root_hash_requests.go +++ b/app/protocol/flows/blockrelay/handle_ibd_root_hash_requests.go @@ -35,6 +35,7 @@ func (flow *handleIBDRootHashRequestsFlow) start() error { if err != nil { return err } + log.Debugf("Got request for IBD root hash") pruningPoint, err := flow.Domain().Consensus().PruningPoint() if err != nil { @@ -45,5 +46,6 @@ func (flow *handleIBDRootHashRequestsFlow) start() error { if err != nil { return err } + log.Debugf("Sent IBD root hash %s", pruningPoint) } } diff --git a/app/protocol/flows/blockrelay/handle_relay_block_requests.go b/app/protocol/flows/blockrelay/handle_relay_block_requests.go index d64cf47cc..db4e54558 100644 --- a/app/protocol/flows/blockrelay/handle_relay_block_requests.go +++ b/app/protocol/flows/blockrelay/handle_relay_block_requests.go @@ -26,6 +26,7 @@ func HandleRelayBlockRequests(context RelayBlockRequestsContext, incomingRoute * return err } getRelayBlocksMessage := message.(*appmessage.MsgRequestRelayBlocks) + log.Debugf("Got request for relay blocks with hashes %s", getRelayBlocksMessage.Hashes) for _, hash := range getRelayBlocksMessage.Hashes { // Fetch the block from the database. blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash) @@ -46,6 +47,7 @@ func HandleRelayBlockRequests(context RelayBlockRequestsContext, incomingRoute * if err != nil { return err } + log.Debugf("Relayed block with hash %s", hash) } } } diff --git a/app/protocol/flows/blockrelay/handle_request_block_locator.go b/app/protocol/flows/blockrelay/handle_request_block_locator.go index 9fe8970aa..a465bf9cb 100644 --- a/app/protocol/flows/blockrelay/handle_request_block_locator.go +++ b/app/protocol/flows/blockrelay/handle_request_block_locator.go @@ -36,6 +36,8 @@ func (flow *handleRequestBlockLocatorFlow) start() error { if err != nil { return err } + log.Debugf("Received getBlockLocator with lowHash: %s, highHash: %s, limit: %d", + lowHash, highHash, limit) locator, err := flow.Domain().Consensus().CreateBlockLocator(lowHash, highHash, limit) if err != nil || len(locator) == 0 { diff --git a/app/protocol/flows/blockrelay/handle_request_headers.go b/app/protocol/flows/blockrelay/handle_request_headers.go index 5d8615b29..312f75af4 100644 --- a/app/protocol/flows/blockrelay/handle_request_headers.go +++ b/app/protocol/flows/blockrelay/handle_request_headers.go @@ -42,9 +42,10 @@ func (flow *handleRequestBlocksFlow) start() error { if err != nil { return err } + log.Debugf("Recieved requestHeaders with lowHash: %s, highHash: %s", lowHash, highHash) for !lowHash.Equal(highHash) { - log.Debugf("Getting block hashes between %s and %s to %s", lowHash, highHash, flow.peer) + log.Debugf("Getting block headers between %s and %s to %s", lowHash, highHash, flow.peer) // GetHashesBetween is a relatively heavy operation so we limit it // in order to avoid locking the consensus for too long diff --git a/app/protocol/flows/blockrelay/handle_request_ibd_root_utxo_set_and_block.go b/app/protocol/flows/blockrelay/handle_request_ibd_root_utxo_set_and_block.go index 659272e85..c031a96df 100644 --- a/app/protocol/flows/blockrelay/handle_request_ibd_root_utxo_set_and_block.go +++ b/app/protocol/flows/blockrelay/handle_request_ibd_root_utxo_set_and_block.go @@ -2,6 +2,7 @@ package blockrelay import ( "errors" + "github.com/kaspanet/kaspad/app/appmessage" "github.com/kaspanet/kaspad/domain" "github.com/kaspanet/kaspad/domain/consensus/ruleerrors" @@ -39,6 +40,8 @@ func (flow *handleRequestIBDRootUTXOSetAndBlockFlow) start() error { } msgRequestIBDRootUTXOSetAndBlock := message.(*appmessage.MsgRequestIBDRootUTXOSetAndBlock) + log.Debugf("Got request for IBDRoot UTXOSet and Block") + utxoSet, err := flow.Domain().Consensus().GetPruningPointUTXOSet(msgRequestIBDRootUTXOSetAndBlock.IBDRoot) if err != nil { if errors.Is(err, ruleerrors.ErrWrongPruningPointHash) { @@ -50,12 +53,15 @@ func (flow *handleRequestIBDRootUTXOSetAndBlockFlow) start() error { continue } } + log.Debugf("Got utxo set for pruning block %s", msgRequestIBDRootUTXOSetAndBlock.IBDRoot) block, err := flow.Domain().Consensus().GetBlock(msgRequestIBDRootUTXOSetAndBlock.IBDRoot) if err != nil { return err } + log.Debugf("Got pruning block %s", msgRequestIBDRootUTXOSetAndBlock.IBDRoot) + err = flow.outgoingRoute.Enqueue(appmessage.NewMsgIBDRootUTXOSetAndBlock(utxoSet, appmessage.DomainBlockToMsgBlock(block))) if err != nil {