Skip to content

Commit

Permalink
use current height when testing nonce submission
Browse files Browse the repository at this point in the history
  • Loading branch information
bold committed May 12, 2019
1 parent e1090ea commit 209dabc
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/com/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ mod tests {
}

#[test]
fn test_get_mining_info() {
fn test_requests() {
let mut rt = tokio::runtime::Runtime::new().expect("can't create runtime");

let client = Client::new(
Expand All @@ -264,28 +264,16 @@ mod tests {
HashMap::new(),
);

if let Err(e) = rt.block_on(client.get_mining_info()) {
assert!(false, format!("can't get mining info: {:?}", e));
}
}

#[test]
fn test_submit_nonce() {
let mut rt = tokio::runtime::Runtime::new().expect("can't create runtime");

let client = Client::new(
BASE_URL.parse().unwrap(),
HashMap::new(),
3,
12,
ProxyDetails::Enabled,
HashMap::new(),
);
let height = match rt.block_on(client.get_mining_info()) {
Err(e) => panic!(format!("can't get mining info: {:?}", e)),
Ok(mining_info) => mining_info.height,
};

// this fails if pinocchio switches to a new block height in the meantime
let nonce_submission_response = rt.block_on(client.submit_nonce(&SubmissionParameters {
account_id: 1337,
nonce: 12,
height: 112,
height,
deadline_unadjusted: 7123,
deadline: 1193,
gen_sig: [0; 32],
Expand Down

0 comments on commit 209dabc

Please sign in to comment.