self.outputs_to_watch.insert(txid.clone(), output_scripts.iter().map(|o| o.script_pubkey.clone()).collect());
}
+ for spend in spendable_outputs.iter() {
+ log_trace!(self, "Announcing spendable output to user: {}", log_spendable!(spend));
+ }
+
if spendable_outputs.len() > 0 {
self.pending_events.push(events::Event::SpendableOutputs {
outputs: spendable_outputs,
use chain::transaction::OutPoint;
+use chain::keysinterface::SpendableOutputDescriptor;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin::blockdata::transaction::Transaction;
}
}
+pub(crate) struct DebugSpendable<'a>(pub &'a SpendableOutputDescriptor);
+impl<'a> std::fmt::Display for DebugSpendable<'a> {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
+ match self.0 {
+ &SpendableOutputDescriptor::StaticOutput { ref outpoint, .. } => {
+ write!(f, "StaticOutput {}:{} marked for spending", outpoint.txid, outpoint.vout)?;
+ }
+ &SpendableOutputDescriptor::DynamicOutputP2WSH { ref outpoint, .. } => {
+ write!(f, "DynamicOutputP2WSH {}:{} marked for spending", outpoint.txid, outpoint.vout)?;
+ }
+ &SpendableOutputDescriptor::DynamicOutputP2WPKH { ref outpoint, .. } => {
+ write!(f, "DynamicOutputP2WPKH {}:{} marked for spending", outpoint.txid, outpoint.vout)?;
+ }
+ }
+ Ok(())
+ }
+}
+
+macro_rules! log_spendable {
+ ($obj: expr) => {
+ ::util::macro_logger::DebugSpendable(&$obj)
+ }
+}
+
macro_rules! log_internal {
($self: ident, $lvl:expr, $($arg:tt)+) => (
&$self.logger.log(&::util::logger::Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()));