Skip to content

Commit

Permalink
Allow to type "hex" before broadcasting instead of showing it always
Browse files Browse the repository at this point in the history
  • Loading branch information
EyeOfPython committed Apr 26, 2019
1 parent a29d6e8 commit e6647d7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/trade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,17 +584,21 @@ pub fn accept_trades_interactive(wallet: &Wallet) -> Result<(), Box<std::error::
let mut tx_ser = Vec::new();
tx.write_to_stream(&mut tx_ser)?;

println!("The transaction hash is:");
println!("{}", hex::encode(&tx_ser));
println!("Type \"hex\" (without quotes) to show the transaction hex instead of broadcasting.");
println!("After broadcasting, your balance will be {} sats.", balance - total_spent);
println!("Should the transaction be broadcast now to seal the deal? Type \"yes\" \
(without quotes): ");

print!("Should the transaction be broadcast now to seal the deal? Type \"yes\" \
(without quotes): ");
io::stdout().flush()?;
let confirm_send: String = read!("{}\n");
if confirm_send.to_ascii_lowercase().trim() == "yes" {
let response = wallet.send_tx(&tx)?;
println!("Sent transaction. Transaction ID is: {}", response);
match confirm_send.to_ascii_lowercase().trim() {
"yes" => {
let response = wallet.send_tx(&tx)?;
println!("Sent transaction. Transaction ID is: {}", response);
},
"hex" => {
println!("{}", hex::encode(&tx_ser));
},
_ => {},
}

Ok(())
Expand Down

0 comments on commit e6647d7

Please sign in to comment.