Browse Source

Print unpublished transaction hex for debugging purposes

Print transaction hex in the logs so that the transaction can be analysed
quicker.
refactor/no-log-handler
Mariusz Klochowicz 3 years ago
parent
commit
0b74c478b1
No known key found for this signature in database GPG Key ID: 470C865699C8D4D
  1. 10
      daemon/src/wallet.rs

10
daemon/src/wallet.rs

@ -1,5 +1,6 @@
use crate::model::WalletInfo;
use anyhow::{Context, Result};
use bdk::bitcoin::consensus::encode::serialize_hex;
use bdk::bitcoin::util::bip32::ExtendedPrivKey;
use bdk::bitcoin::util::psbt::PartiallySignedTransaction;
use bdk::bitcoin::{Amount, PublicKey, Transaction, Txid};
@ -96,7 +97,14 @@ impl Wallet {
// TODO: Optimize this match to be a map_err / more readable in general
let txid = tx.txid();
let result = wallet.broadcast(tx);
let result = wallet.broadcast(tx.clone());
if result.is_err() {
tracing::error!(
"Broadcasting transaction failed. Raw transaction: {}",
serialize_hex(&tx)
);
}
if let Err(&bdk::Error::Electrum(electrum_client::Error::Protocol(ref value))) =
result.as_ref()

Loading…
Cancel
Save