File tree Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to the versioning scheme outlined in the [ README.md] ( README.md ) .
7
7
8
+ ## [ 3.1.0.0.11]
9
+
10
+ - Hotfix for p2p stack misbehavior in mempool syncing conditions
11
+
8
12
## [ 3.1.0.0.10]
9
13
10
14
### Added
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ pub struct StacksMemPoolStream {
97
97
pub corked : bool ,
98
98
/// Did we run out of transactions to send?
99
99
pub finished : bool ,
100
+ num_bytes : u64 ,
100
101
/// link to the mempool DB
101
102
mempool_db : DBConn ,
102
103
}
@@ -118,6 +119,7 @@ impl StacksMemPoolStream {
118
119
tx_query,
119
120
last_randomized_txid,
120
121
num_txs : 0 ,
122
+ num_bytes : 0 ,
121
123
max_txs,
122
124
coinbase_height,
123
125
corked : false ,
@@ -178,6 +180,14 @@ impl HttpChunkGenerator for StacksMemPoolStream {
178
180
if !next_txs. is_empty ( ) {
179
181
// have another tx to send
180
182
let chunk = next_txs[ 0 ] . serialize_to_vec ( ) ;
183
+ if u64:: try_from ( chunk. len ( ) )
184
+ . unwrap ( )
185
+ . saturating_add ( self . num_bytes )
186
+ >= u64:: from ( MAX_MESSAGE_LEN ) / 2
187
+ {
188
+ self . corked = true ;
189
+ return Ok ( self . last_randomized_txid . serialize_to_vec ( ) ) ;
190
+ }
181
191
if let Some ( next_last_randomized_txid) = next_last_randomized_txid_opt {
182
192
// we have more after this
183
193
self . last_randomized_txid = next_last_randomized_txid;
@@ -187,6 +197,9 @@ impl HttpChunkGenerator for StacksMemPoolStream {
187
197
self . finished = true ;
188
198
}
189
199
self . num_txs += next_txs. len ( ) as u64 ;
200
+ self . num_bytes = self
201
+ . num_bytes
202
+ . saturating_add ( u64:: try_from ( chunk. len ( ) ) . unwrap ( ) ) ;
190
203
return Ok ( chunk) ;
191
204
} else if let Some ( next_txid) = next_last_randomized_txid_opt {
192
205
// no more txs to send
Original file line number Diff line number Diff line change @@ -937,7 +937,12 @@ impl<P: ProtocolFamily> ConnectionInbox<P> {
937
937
) ;
938
938
self . inbox . push_back ( message) ;
939
939
consumed_message = true ;
940
- } ;
940
+ } else {
941
+ if bytes_consumed == 0 {
942
+ warn ! ( "0 bytes consumed, but no message parsed" ) ;
943
+ return Err ( net_error:: ConnectionBroken ) ;
944
+ }
945
+ }
941
946
942
947
bytes_consumed
943
948
} else {
Original file line number Diff line number Diff line change 1
1
# Update these values when a new release is created.
2
2
# `stacks-common/build.rs` will automatically update `versions.rs` with these values.
3
- stacks_node_version = " 3.1.0.0.10 "
4
- stacks_signer_version = " 3.1.0.0.10 .0"
3
+ stacks_node_version = " 3.1.0.0.11 "
4
+ stacks_signer_version = " 3.1.0.0.11 .0"
You can’t perform that action at this time.
0 commit comments