Return Signature from transfer_signed and send_airdrop

This commit is contained in:
Greg Fitzgerald
2018-07-20 18:58:13 -04:00
parent 6a8379109d
commit c068ca4cb7
2 changed files with 10 additions and 9 deletions

View File

@@ -88,10 +88,11 @@ impl ThinClient {
/// Send a signed Transaction to the server for processing. This method
/// does not wait for a response.
pub fn transfer_signed(&self, tx: &Transaction) -> io::Result<usize> {
pub fn transfer_signed(&self, tx: &Transaction) -> io::Result<Signature> {
let data = serialize(&tx).expect("serialize Transaction in pub fn transfer_signed");
self.transactions_socket
.send_to(&data, &self.transactions_addr)
.send_to(&data, &self.transactions_addr)?;
Ok(tx.sig)
}
/// Creates, signs, and processes a Transaction. Useful for writing unit-tests.
@@ -104,8 +105,7 @@ impl ThinClient {
) -> io::Result<Signature> {
let now = Instant::now();
let tx = Transaction::new(keypair, to, n, *last_id);
let sig = tx.sig;
let result = self.transfer_signed(&tx).map(|_| sig);
let result = self.transfer_signed(&tx);
metrics::submit(
influxdb::Point::new("thinclient")
.add_tag("op", influxdb::Value::String("transfer".to_string()))