Skip to content

Commit 49a2f05

Browse files
Add tests/signer/commands/transfer.rs
Co-authored-by: Nikos Baxevanis <[email protected]>
1 parent 095c40f commit 49a2f05

File tree

1 file changed

+40
-0
lines changed
  • testnet/stacks-node/src/tests/signer/commands

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use super::context::{SignerTestContext, SignerTestState};
2+
use crate::tests::signer::v0::MultipleMinerTest;
3+
use madhouse::{Command, CommandWrapper};
4+
use proptest::prelude::{Just, Strategy};
5+
use std::sync::{Arc, Mutex};
6+
7+
pub struct SendTransferTxCommand {
8+
miners: Arc<Mutex<MultipleMinerTest>>,
9+
}
10+
11+
impl SendTransferTxCommand {
12+
pub fn new(miners: Arc<Mutex<MultipleMinerTest>>) -> Self {
13+
Self { miners }
14+
}
15+
}
16+
17+
impl Command<SignerTestState, SignerTestContext> for SendTransferTxCommand {
18+
fn check(&self, _state: &SignerTestState) -> bool {
19+
println!("Checking: Sending transfer tx. Result: {:?}", true);
20+
true
21+
}
22+
23+
fn apply(&self, _state: &mut SignerTestState) {
24+
println!("Applying: Sending transfer tx");
25+
26+
self.miners.lock().unwrap().send_transfer_tx();
27+
}
28+
29+
fn label(&self) -> String {
30+
"SEND_TRANSFER_TX".to_string()
31+
}
32+
33+
fn build(
34+
ctx: Arc<SignerTestContext>,
35+
) -> impl Strategy<Value = CommandWrapper<SignerTestState, SignerTestContext>> {
36+
Just(CommandWrapper::new(SendTransferTxCommand::new(
37+
ctx.miners.clone(),
38+
)))
39+
}
40+
}

0 commit comments

Comments
 (0)