diff --git a/stacks-signer/src/client/stackerdb.rs b/stacks-signer/src/client/stackerdb.rs index e0c6cb1621..499bdddd5f 100644 --- a/stacks-signer/src/client/stackerdb.rs +++ b/stacks-signer/src/client/stackerdb.rs @@ -234,7 +234,7 @@ mod tests { use blockstack_lib::chainstate::nakamoto::{NakamotoBlock, NakamotoBlockHeader}; use clarity::util::hash::{MerkleTree, Sha512Trunc256Sum}; - use libsigner::v0::messages::SignerMessage; + use libsigner::v0::messages::{BlockRejection, BlockResponse, RejectCode, SignerMessage}; use libsigner::BlockProposal; use rand::{thread_rng, RngCore}; @@ -276,12 +276,12 @@ mod tests { }; block.header.tx_merkle_root = tx_merkle_root; - let block_proposal = BlockProposal { - block, - burn_height: thread_rng().next_u64(), - reward_cycle: thread_rng().next_u64(), + let block_reject = BlockRejection { + reason: "Did not like it".into(), + reason_code: RejectCode::RejectedInPriorRound, + signer_signature_hash: block.header.signer_signature_hash(), }; - let signer_message = SignerMessage::BlockProposal(block_proposal); + let signer_message = SignerMessage::BlockResponse(BlockResponse::Rejected(block_reject)); let ack = StackerDBChunkAckData { accepted: true, reason: None, @@ -289,12 +289,13 @@ mod tests { code: None, }; let mock_server = mock_server_from_config(&config); - let h = spawn(move || stackerdb.send_message_with_retry(signer_message)); + debug!("Spawning msg sender"); + let h = spawn(move || stackerdb.send_message_with_retry(signer_message).unwrap()); let mut response_bytes = b"HTTP/1.1 200 OK\n\n".to_vec(); let payload = serde_json::to_string(&ack).expect("Failed to serialize ack"); response_bytes.extend(payload.as_bytes()); std::thread::sleep(Duration::from_millis(500)); write_response(mock_server, response_bytes.as_slice()); - assert_eq!(ack, h.join().unwrap().unwrap()); + assert_eq!(ack, h.join().unwrap()); } }