-
Notifications
You must be signed in to change notification settings - Fork 569
Closed
Description
Just copy-pasting from discord here.
It happens on testnet, and I'm guessing main net as well.
The sequence I'm trying goes like so (this is all clean slate, with fresh profile dirs);
- start one node
- exec
getnewaddress
- exec
generatetoaddress 1 <address>
(this can be any number of blocks) - start a second node and connect it to the first one
- get this in debug on the first node:
2021-03-11T15:01:15Z received getdata (1 invsz) peer=0
2021-03-11T15:01:15Z received getdata for: witness-block 17821b487854a6930811b560bc3ca3d6d1b59e8363f6d53f144e3b2e05677cac peer=0
- get this in debug on the second node (or any other nodes connecting later on):
2021-03-11T15:01:15Z Ignoring getheaders from peer=0 because node is in initial block download
2021-03-11T15:01:15Z received: headers (87 bytes) peer=0
2021-03-11T15:01:15Z Synchronizing blockheaders, height: 1 (~100.00%)
2021-03-11T15:01:15Z Requesting block 17821b487854a6930811b560bc3ca3d6d1b59e8363f6d53f144e3b2e05677cac (1) peer=0
2021-03-11T15:01:15Z sending getdata (37 bytes) peer=0
2021-03-11T15:01:15Z received: block (171 bytes) peer=0
2021-03-11T15:01:15Z ProcessMessages(block, 171 bytes): Exception 'CDataStream::read(): end of data: iostream error' (NSt8ios_base7failureB5cxx11E) caught
2021-03-11T15:01:15Z ProcessMessages(block, 171 bytes) FAILED peer=0
Somewhat amusingly; when running the nodes at the same time this will only occur once every other reset.
But as soon as you close the first peer and re-start it with a fresh profile, it starts failing again.
Now given that this seems to be vaguely related to segwit I have tried this patch:
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 0d98b5c67..6d50cfff7 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2062,7 +2062,7 @@ bool ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRec
if((nServices & NODE_WITNESS))
{
LOCK(cs_main);
- State(pfrom->GetId())->fHaveWitness = true;
+ State(pfrom->GetId())->fHaveWitness = false;
}
// Potentially mark this peer as a preferred download peer.
diff --git a/src/validation.cpp b/src/validation.cpp
index 773e00266..bbed352e8 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3197,6 +3197,7 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu
bool IsWitnessEnabled(const CBlockIndex* pindexPrev, const Consensus::Params& params)
{
+ return false;
return pindexPrev ? IsBTC16BIPsEnabled(pindexPrev->nTime) : false; // pindexPrev == null on genesis block
}
@@ -3385,7 +3386,7 @@ static bool ContextualCheckBlock(const CBlock& block, BlockValidationState& stat
if (memcmp(hashWitness.begin(), &block.vtx[0]->vout[commitpos].scriptPubKey[6], 32)) {
return state.Invalid(BlockValidationResult::BLOCK_MUTATED, "bad-witness-merkle-match", strprintf("%s : witness merkle commitment mismatch", __func__));
}
- fHaveWitness = true;
+ fHaveWitness = false;
}
}
That makes it work, but it seems to be like a bad idea to just disable segwit for what appears to be a minor networking issue.
This same sequence does not fail on the release-0.9 branch.