Skip to content

Commit

Permalink
make resubmissions work
Browse files Browse the repository at this point in the history
  • Loading branch information
bold committed May 11, 2019
1 parent 1281930 commit e0f5e88
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Ord for SubmissionParameters {
Ordering::Greater
} else if self.gen_sig == other.gen_sig {
// on the same chain, best deadline wins
if self.deadline < other.deadline {
if self.deadline <= other.deadline {
Ordering::Greater
} else {
Ordering::Less
Expand Down
35 changes: 35 additions & 0 deletions src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,38 @@ fn log_submission_accepted(account_id: u64, nonce: u64, deadline: u64) {
account_id, nonce, deadline
);
}

#[cfg(test)]
mod tests {
use super::*;
use tokio;

static BASE_URL: &str = "http://94.130.178.37:31000";

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

let request_handler = RequestHandler::new(
BASE_URL.parse().unwrap(),
HashMap::new(),
3,
12,
true,
HashMap::new(),
rt.executor(),
);

request_handler.submit_nonce(
1337,
12,
111,
7123,
1193,
[0; 32],
);

rt.shutdown_on_idle();
}
}

0 comments on commit e0f5e88

Please sign in to comment.