Return results instead of JSON

This commit is contained in:
Aditya Kulkarni
2019-10-19 20:21:53 -07:00
parent 0e529ba4cd
commit 19d9dfa18e
2 changed files with 13 additions and 10 deletions

View File

@@ -789,7 +789,7 @@ impl LightClient {
responses.join("\n")
}
pub fn do_send(&self, addrs: Vec<(&str, u64, Option<String>)>) -> String {
pub fn do_send(&self, addrs: Vec<(&str, u64, Option<String>)>) -> Result<String, String> {
info!("Creating transaction");
let rawtx = self.wallet.write().unwrap().send_to_address(
@@ -799,11 +799,8 @@ impl LightClient {
);
match rawtx {
Ok(txbytes) => match broadcast_raw_tx(&self.get_server_uri(), self.config.no_cert_verification, txbytes) {
Ok(k) => k,
Err(e) => e,
},
Err(e) => format!("Error: No Tx to broadcast. Error was: {}", e)
Ok(txbytes) => broadcast_raw_tx(&self.get_server_uri(), self.config.no_cert_verification, txbytes),
Err(e) => Err(format!("Error: No Tx to broadcast. Error was: {}", e))
}
}
}