add method add_data as a shortcut to create an OP_RETURN output, fix the dust check to consider only spendable output

This commit is contained in:
Riccardo Casatta
2021-10-27 16:34:33 +02:00
parent 711510006b
commit fd51029197
2 changed files with 8 additions and 1 deletions

View File

@@ -560,6 +560,13 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>> TxBuilder<'a, B, D,
self
}
/// Add data as an output, using OP_RETURN
pub fn add_data(&mut self, data: &[u8]) -> &mut Self {
let script = Script::new_op_return(data);
self.add_recipient(script, 0u64);
self
}
/// Sets the address to *drain* excess coins to.
///
/// Usually, when there are excess coins they are sent to a change address generated by the