Return txid from send
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
use log::{error};
|
use log::{error};
|
||||||
|
|
||||||
use std::sync::{Arc};
|
use std::sync::{Arc};
|
||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
use json::object;
|
||||||
|
|
||||||
use futures::{Future};
|
use futures::{Future};
|
||||||
use futures::stream::Stream;
|
use futures::stream::Stream;
|
||||||
|
|
||||||
@@ -280,7 +281,16 @@ pub fn broadcast_raw_tx(uri: &http::Uri, no_cert: bool, tx_bytes: Box<[u8]>) ->
|
|||||||
.and_then(move |response| {
|
.and_then(move |response| {
|
||||||
let sendresponse = response.into_inner();
|
let sendresponse = response.into_inner();
|
||||||
if sendresponse.error_code == 0 {
|
if sendresponse.error_code == 0 {
|
||||||
Ok(format!("Successfully broadcast Tx: {}", sendresponse.error_message))
|
let mut txid = sendresponse.error_message;
|
||||||
|
if txid.starts_with("\"") && txid.ends_with("\"") {
|
||||||
|
txid = txid[1..txid.len()-1].to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
let r = object!{
|
||||||
|
"result" => "success",
|
||||||
|
"txid" => txid,
|
||||||
|
};
|
||||||
|
Ok(r.pretty(2))
|
||||||
} else {
|
} else {
|
||||||
Err(format!("Error: {:?}", sendresponse))
|
Err(format!("Error: {:?}", sendresponse))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -771,7 +771,7 @@ impl LightClient {
|
|||||||
Ok(k) => k,
|
Ok(k) => k,
|
||||||
Err(e) => e,
|
Err(e) => e,
|
||||||
},
|
},
|
||||||
Err(e) => format!("No Tx to broadcast. Error was: {}", e)
|
Err(e) => format!("Error: No Tx to broadcast. Error was: {}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ pub struct WalletTx {
|
|||||||
// All outgoing sapling sends to addresses outside this wallet
|
// All outgoing sapling sends to addresses outside this wallet
|
||||||
pub outgoing_metadata: Vec<OutgoingTxMetadata>,
|
pub outgoing_metadata: Vec<OutgoingTxMetadata>,
|
||||||
|
|
||||||
|
// Whether this TxID was downloaded from the server and scanned for Memos
|
||||||
pub full_tx_scanned: bool,
|
pub full_tx_scanned: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user