Update last_id between client retries

Fixes #1694
This commit is contained in:
Greg Fitzgerald
2018-11-06 06:07:43 -07:00
parent 6b5d12a8bb
commit 54968b59bb
4 changed files with 14 additions and 11 deletions

View File

@ -75,13 +75,15 @@ impl ThinClient {
}
/// Retry a sending a signed Transaction to the server for processing.
pub fn retry_transfer_signed(
pub fn retry_transfer(
&mut self,
tx: &Transaction,
keypair: &Keypair,
tx: &mut Transaction,
tries: usize,
) -> io::Result<Signature> {
let data = serialize(&tx).expect("serialize Transaction in pub fn transfer_signed");
for x in 0..tries {
tx.sign(&keypair, self.get_last_id());
let data = serialize(&tx).expect("serialize Transaction in pub fn transfer_signed");
self.transactions_socket
.send_to(&data, &self.transactions_addr)?;
if self.poll_for_signature(&tx.signature).is_ok() {
@ -91,7 +93,7 @@ impl ThinClient {
}
Err(io::Error::new(
io::ErrorKind::Other,
"retry_transfer_signed failed",
"retry_transfer failed",
))
}