mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
move txpool reconcile_block to after block propagation in adapter (#2000)
This commit is contained in:
parent
0eec80789a
commit
e86eb641f1
1 changed files with 10 additions and 8 deletions
|
@ -651,14 +651,6 @@ impl ChainAdapter for ChainToPoolAndNetAdapter {
|
|||
|
||||
debug!("adapter: block_accepted: {:?}", b.hash());
|
||||
|
||||
if let Err(e) = self.tx_pool.write().reconcile_block(b) {
|
||||
error!(
|
||||
"Pool could not update itself at block {}: {:?}",
|
||||
b.hash(),
|
||||
e,
|
||||
);
|
||||
}
|
||||
|
||||
// If we mined the block then we want to broadcast the compact block.
|
||||
// If we received the block from another node then broadcast "header first"
|
||||
// to minimize network traffic.
|
||||
|
@ -670,6 +662,16 @@ impl ChainAdapter for ChainToPoolAndNetAdapter {
|
|||
// "header first" propagation if we are not the originator of this block
|
||||
self.peers().broadcast_header(&b.header);
|
||||
}
|
||||
|
||||
// Reconcile the txpool against the new block *after* we have broadcast it too our peers.
|
||||
// This may be slow and we do not want to delay block propagation.
|
||||
if let Err(e) = self.tx_pool.write().reconcile_block(b) {
|
||||
error!(
|
||||
"Pool could not update itself at block {}: {:?}",
|
||||
b.hash(),
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue