|
15 | 15 | use std::collections::HashMap;
|
16 | 16 | use std::fmt::Debug;
|
17 | 17 | use std::sync::mpsc::Sender;
|
18 |
| -use std::time::{Duration, Instant}; |
19 | 18 |
|
20 | 19 | use blockstack_lib::chainstate::nakamoto::{NakamotoBlock, NakamotoBlockHeader};
|
21 | 20 | use blockstack_lib::net::api::postblock_proposal::{
|
@@ -192,23 +191,7 @@ impl SignerTrait<SignerMessage> for Signer {
|
192 | 191 | "block_id" => %b.block_id(),
|
193 | 192 | "signer_sighash" => %b.header.signer_signature_hash(),
|
194 | 193 | );
|
195 |
| - let start_time = Instant::now(); |
196 |
| - loop { |
197 |
| - match stacks_client.post_block(b) { |
198 |
| - Ok(block_push_result) => { |
199 |
| - debug!("{self}: Block pushed to stacks node: {block_push_result:?}"); |
200 |
| - break; |
201 |
| - } |
202 |
| - Err(e) => { |
203 |
| - if cfg!(test) |
204 |
| - && start_time.elapsed() > Duration::from_secs(30) |
205 |
| - { |
206 |
| - panic!("{self}: Timed out in test while pushing block to stacks node: {e}"); |
207 |
| - } |
208 |
| - warn!("{self}: Failed to push block to stacks node: {e}. Retrying..."); |
209 |
| - } |
210 |
| - }; |
211 |
| - } |
| 194 | + stacks_client.post_block_until_ok(self, &b); |
212 | 195 | }
|
213 | 196 | SignerMessage::MockProposal(mock_proposal) => {
|
214 | 197 | let epoch = match stacks_client.get_node_epoch() {
|
@@ -907,15 +890,7 @@ impl Signer {
|
907 | 890 | "{self}: Broadcasting Stacks block {} to node",
|
908 | 891 | &block.block_id()
|
909 | 892 | );
|
910 |
| - if let Err(e) = stacks_client.post_block(&block) { |
911 |
| - warn!( |
912 |
| - "{self}: Failed to post block {block_hash}: {e:?}"; |
913 |
| - "stacks_block_id" => %block.block_id(), |
914 |
| - "parent_block_id" => %block.header.parent_block_id, |
915 |
| - "burnchain_consensus_hash" => %block.header.consensus_hash |
916 |
| - ); |
917 |
| - return; |
918 |
| - } |
| 893 | + stacks_client.post_block_until_ok(self, &block); |
919 | 894 |
|
920 | 895 | if let Err(e) = self.signer_db.set_block_broadcasted(
|
921 | 896 | self.reward_cycle,
|
|
0 commit comments