mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Fix bug where we were executing block callbacks when we hadn't seen a block header (#5455)
* Fix bug where we were executing block callbacks when we hadn't seen a block header * reduce log to DEBUG
This commit is contained in:
parent
238948e185
commit
898d2b44ee
@ -100,6 +100,8 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest {
|
||||
nodeCallbacks = NodeCallbacks.onBlockReceived(callback)
|
||||
_ = node.nodeAppConfig.addCallbacks(nodeCallbacks)
|
||||
hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head)
|
||||
_ <- NodeTestUtil.awaitAllSync(node, bitcoind)
|
||||
_ <- node.downloadBlocks(Vector(hash.flip))
|
||||
result = Await.result(resultP.future, 30.seconds)
|
||||
} yield assert(result.blockHeader.hashBE == hash)
|
||||
}
|
||||
|
@ -310,11 +310,7 @@ case class DataMessageHandler(
|
||||
HeadersMessage(CompactSizeUInt.one, Vector(block.blockHeader))
|
||||
val newDmhF = handleDataPayload(payload = headersMessage,
|
||||
peerData = peerData)
|
||||
newDmhF.flatMap { dmh =>
|
||||
appConfig.callBacks
|
||||
.executeOnBlockReceivedCallbacks(block)
|
||||
.map(_ => dmh)
|
||||
}
|
||||
newDmhF
|
||||
} else {
|
||||
logger.info(
|
||||
s"Received block=${block.blockHeader.hash.flip.hex} state=$state")
|
||||
@ -508,7 +504,7 @@ case class DataMessageHandler(
|
||||
stopBlockHash: DoubleSha256DigestBE,
|
||||
startHeightOpt: Option[Int],
|
||||
syncNodeState: SyncNodeState): Future[Option[NodeState.FilterSync]] = {
|
||||
logger.info(s"Beginning to sync filters to stopBlockHashBE=$stopBlockHash")
|
||||
logger.debug(s"Beginning to sync filters to stopBlockHashBE=$stopBlockHash")
|
||||
|
||||
val fs = syncNodeState match {
|
||||
case x @ (_: HeaderSync | _: FilterHeaderSync) =>
|
||||
|
Loading…
Reference in New Issue
Block a user