mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59:33 +00:00
Added some logs to block-relay and IBD flows (#1384)
Co-authored-by: stasatdaglabs <39559713+stasatdaglabs@users.noreply.github.com>
This commit is contained in:
parent
c6d20c1f6f
commit
09e1a73340
@ -25,7 +25,8 @@ func HandleIBDBlockRequests(context HandleIBDBlockRequestsContext, incomingRoute
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
msgRequestIBDBlocks := message.(*appmessage.MsgRequestIBDBlocks)
|
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.
|
// Fetch the block from the database.
|
||||||
blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash)
|
blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -47,6 +48,7 @@ func HandleIBDBlockRequests(context HandleIBDBlockRequestsContext, incomingRoute
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("sent %d out of %d", i, len(msgRequestIBDBlocks.Hashes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ func (flow *handleIBDRootHashRequestsFlow) start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("Got request for IBD root hash")
|
||||||
|
|
||||||
pruningPoint, err := flow.Domain().Consensus().PruningPoint()
|
pruningPoint, err := flow.Domain().Consensus().PruningPoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -45,5 +46,6 @@ func (flow *handleIBDRootHashRequestsFlow) start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("Sent IBD root hash %s", pruningPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ func HandleRelayBlockRequests(context RelayBlockRequestsContext, incomingRoute *
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
getRelayBlocksMessage := message.(*appmessage.MsgRequestRelayBlocks)
|
getRelayBlocksMessage := message.(*appmessage.MsgRequestRelayBlocks)
|
||||||
|
log.Debugf("Got request for relay blocks with hashes %s", getRelayBlocksMessage.Hashes)
|
||||||
for _, hash := range getRelayBlocksMessage.Hashes {
|
for _, hash := range getRelayBlocksMessage.Hashes {
|
||||||
// Fetch the block from the database.
|
// Fetch the block from the database.
|
||||||
blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash)
|
blockInfo, err := context.Domain().Consensus().GetBlockInfo(hash)
|
||||||
@ -46,6 +47,7 @@ func HandleRelayBlockRequests(context RelayBlockRequestsContext, incomingRoute *
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("Relayed block with hash %s", hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ func (flow *handleRequestBlockLocatorFlow) start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
locator, err := flow.Domain().Consensus().CreateBlockLocator(lowHash, highHash, limit)
|
||||||
if err != nil || len(locator) == 0 {
|
if err != nil || len(locator) == 0 {
|
||||||
|
@ -42,9 +42,10 @@ func (flow *handleRequestBlocksFlow) start() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("Recieved requestHeaders with lowHash: %s, highHash: %s", lowHash, highHash)
|
||||||
|
|
||||||
for !lowHash.Equal(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
|
// GetHashesBetween is a relatively heavy operation so we limit it
|
||||||
// in order to avoid locking the consensus for too long
|
// in order to avoid locking the consensus for too long
|
||||||
|
@ -2,6 +2,7 @@ package blockrelay
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/kaspanet/kaspad/app/appmessage"
|
"github.com/kaspanet/kaspad/app/appmessage"
|
||||||
"github.com/kaspanet/kaspad/domain"
|
"github.com/kaspanet/kaspad/domain"
|
||||||
"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
|
"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
|
||||||
@ -39,6 +40,8 @@ func (flow *handleRequestIBDRootUTXOSetAndBlockFlow) start() error {
|
|||||||
}
|
}
|
||||||
msgRequestIBDRootUTXOSetAndBlock := message.(*appmessage.MsgRequestIBDRootUTXOSetAndBlock)
|
msgRequestIBDRootUTXOSetAndBlock := message.(*appmessage.MsgRequestIBDRootUTXOSetAndBlock)
|
||||||
|
|
||||||
|
log.Debugf("Got request for IBDRoot UTXOSet and Block")
|
||||||
|
|
||||||
utxoSet, err := flow.Domain().Consensus().GetPruningPointUTXOSet(msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
utxoSet, err := flow.Domain().Consensus().GetPruningPointUTXOSet(msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, ruleerrors.ErrWrongPruningPointHash) {
|
if errors.Is(err, ruleerrors.ErrWrongPruningPointHash) {
|
||||||
@ -50,12 +53,15 @@ func (flow *handleRequestIBDRootUTXOSetAndBlockFlow) start() error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Debugf("Got utxo set for pruning block %s", msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
||||||
|
|
||||||
block, err := flow.Domain().Consensus().GetBlock(msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
block, err := flow.Domain().Consensus().GetBlock(msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("Got pruning block %s", msgRequestIBDRootUTXOSetAndBlock.IBDRoot)
|
||||||
|
|
||||||
err = flow.outgoingRoute.Enqueue(appmessage.NewMsgIBDRootUTXOSetAndBlock(utxoSet,
|
err = flow.outgoingRoute.Enqueue(appmessage.NewMsgIBDRootUTXOSetAndBlock(utxoSet,
|
||||||
appmessage.DomainBlockToMsgBlock(block)))
|
appmessage.DomainBlockToMsgBlock(block)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user