Request witness blocks from peers (#2289)

This commit is contained in:
Ben Carman 2020-11-23 22:08:03 -06:00 committed by GitHub
parent 6c1992c116
commit 197367dc33
3 changed files with 8 additions and 8 deletions

View File

@ -126,9 +126,7 @@ class NeutrinoNodeWithWalletTest extends NodeUnitTest {
)
}
val countF = node.chainApiFromDb().flatMap(_.getFilterHeaderCount)
for {
count <- countF
_ <- node.sync()
_ <- NodeTestUtil.awaitSync(node, bitcoind)
_ <- NodeTestUtil.awaitCompactFilterHeadersSync(node, bitcoind)
@ -148,9 +146,8 @@ class NeutrinoNodeWithWalletTest extends NodeUnitTest {
// receive
address <- wallet.getNewAddress()
_ <-
bitcoind
.sendToAddress(address, TestAmount)
txId <- bitcoind.sendToAddress(address, TestAmount)
expectedTx <- bitcoind.getRawTransactionRaw(txId)
_ <-
bitcoind.getNewAddress
@ -159,7 +156,10 @@ class NeutrinoNodeWithWalletTest extends NodeUnitTest {
_ <- NodeTestUtil.awaitCompactFiltersSync(node, bitcoind)
_ <- AsyncUtil.awaitConditionF(condition2)
} yield succeed
// assert we got the full tx with witness data
txs <- wallet.listTransactions()
} yield assert(txs.exists(_.transaction == expectedTx))
}
it must "watch an arbitrary SPK" taggedAs UsesExperimentalBitcoind in {

View File

@ -245,7 +245,7 @@ trait Node extends NodeApi with ChainQueryApi with P2PLogger {
} else {
for {
peerMsgSender <- peerMsgSenderF
_ <- peerMsgSender.sendGetDataMessage(TypeIdentifier.MsgBlock,
_ <- peerMsgSender.sendGetDataMessage(TypeIdentifier.MsgWitnessBlock,
blockHashes: _*)
} yield ()
}

View File

@ -376,7 +376,7 @@ case class DataMessageHandler(
case NodeType.SpvNode =>
Inventory(TypeIdentifier.MsgFilteredBlock, hash)
case NodeType.NeutrinoNode | NodeType.FullNode =>
Inventory(TypeIdentifier.MsgBlock, hash)
Inventory(TypeIdentifier.MsgWitnessBlock, hash)
case NodeType.BitcoindBackend =>
throw new RuntimeException("This is impossible")
}