test: set nonce for tx stream explicitly (#1354)
This commit is contained in:
parent
f56146025a
commit
0197fe3fc4
|
@ -495,10 +495,10 @@ pub mod spoof {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{Http, Middleware, Provider};
|
||||
use crate::{Http, Provider};
|
||||
use ethers_core::{
|
||||
types::TransactionRequest,
|
||||
utils::{get_contract_address, keccak256, parse_ether, Anvil, Geth},
|
||||
utils::{get_contract_address, keccak256, parse_ether, Geth},
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
|
@ -516,7 +516,7 @@ mod tests {
|
|||
}
|
||||
|
||||
// Tests "roundtrip" serialization of calls: deserialize(serialize(call)) == call
|
||||
fn test_encode<'a, P>(call: CallBuilder<'a, P>) {
|
||||
fn test_encode<P>(call: CallBuilder<P>) {
|
||||
let input = call.unwrap().input;
|
||||
let ser = utils::serialize(&input).to_string();
|
||||
let de: CallInputOwned = serde_json::from_str(&ser).unwrap();
|
||||
|
|
|
@ -190,7 +190,7 @@ where
|
|||
poll_broadcast_fut!(cx, this, fut);
|
||||
}
|
||||
Sleeping(delay) => {
|
||||
let _ready = futures_util::ready!(delay.as_mut().poll(cx));
|
||||
futures_util::ready!(delay.as_mut().poll(cx));
|
||||
// if broadcast timer has elapsed and if we have a TX to
|
||||
// broadcast, broadcast it
|
||||
if this.last.elapsed() > *this.broadcast_interval {
|
||||
|
|
|
@ -172,7 +172,7 @@ impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P> {
|
|||
|
||||
match this.state {
|
||||
PendingTxState::InitialDelay(fut) => {
|
||||
let _ready = futures_util::ready!(fut.as_mut().poll(ctx));
|
||||
futures_util::ready!(fut.as_mut().poll(ctx));
|
||||
tracing::debug!("Starting to poll pending tx {:?}", *this.tx_hash);
|
||||
let fut = Box::pin(this.provider.get_transaction(*this.tx_hash));
|
||||
rewake_with_new_state!(ctx, this, PendingTxState::GettingTx(fut));
|
||||
|
|
|
@ -284,7 +284,11 @@ mod tests {
|
|||
let tx = TransactionRequest::new().from(accounts[0]).to(accounts[0]).value(1e18 as u64);
|
||||
|
||||
let mut sending = futures_util::future::join_all(
|
||||
std::iter::repeat(tx.clone()).take(num_txs).map(|tx| async {
|
||||
std::iter::repeat(tx.clone())
|
||||
.take(num_txs)
|
||||
.enumerate()
|
||||
.map(|(nonce, tx)| tx.nonce(nonce))
|
||||
.map(|tx| async {
|
||||
provider.send_transaction(tx, None).await.unwrap().await.unwrap().unwrap()
|
||||
}),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue