Skip to content

Commit 99c209c

Browse files
committed
fix: NACK getchunks and getchunksinv requests with NackErrorCodes::StaleView if the rc_consensus_hash doesn't match
1 parent bc716db commit 99c209c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

stackslib/src/net/chat.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,8 @@ impl ConversationP2P {
13391339
self.update_from_stacker_db_handshake_data(stackerdb_accept);
13401340
} else {
13411341
// remote peer's burnchain view has diverged, so assume no longer replicating (we
1342-
// can't talk to it anyway). This can happen once per reward cycle for a few
1343-
// minutes as nodes begin the next reward cycle, but it's harmless -- at worst, it
1342+
// can't talk to it anyway). This can happen once per burnchain block for a few
1343+
// seconds as nodes begin processing the next Stacks blocks, but it's harmless -- at worst, it
13441344
// just means that no stacker DB replication happens between this peer and
13451345
// localhost during this time.
13461346
self.clear_stacker_db_handshake_data();
@@ -1779,13 +1779,16 @@ impl ConversationP2P {
17791779
let local_peer = network.get_local_peer();
17801780
let burnchain_view = network.get_chain_view();
17811781

1782+
// remote peer's Stacks chain tip is different from ours, meaning it might have a different
1783+
// stackerdb configuration view (and we won't be able to authenticate their chunks, and
1784+
// vice versa)
17821785
if burnchain_view.rc_consensus_hash != getchunkinv.rc_consensus_hash {
17831786
debug!(
17841787
"{:?}: NACK StackerDBGetChunkInv; {} != {}",
17851788
local_peer, &burnchain_view.rc_consensus_hash, &getchunkinv.rc_consensus_hash
17861789
);
17871790
return Ok(StacksMessageType::Nack(NackData::new(
1788-
NackErrorCodes::InvalidPoxFork,
1791+
NackErrorCodes::StaleView,
17891792
)));
17901793
}
17911794

@@ -1827,7 +1830,7 @@ impl ConversationP2P {
18271830
local_peer, &burnchain_view.rc_consensus_hash, &getchunk.rc_consensus_hash
18281831
);
18291832
return Ok(StacksMessageType::Nack(NackData::new(
1830-
NackErrorCodes::InvalidPoxFork,
1833+
NackErrorCodes::StaleView,
18311834
)));
18321835
}
18331836

0 commit comments

Comments
 (0)