mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-22 02:34:55 +00:00
Add an anyone-can-pay output to every Bitcoin transaction
Resolves #284.
This commit is contained in:
parent
93c7d06684
commit
76a3f3ec4b
1 changed files with 13 additions and 1 deletions
|
@ -59,10 +59,22 @@ fn signable_transaction<D: Db>(
|
|||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
/*
|
||||
Push a payment to a key with a known private key which anyone can spend. If this transaction
|
||||
gets stuck, this lets anyone create a child transaction spending this output, raising the fee,
|
||||
getting the transaction unstuck (via CPFP).
|
||||
*/
|
||||
payments.push(Payment::new(
|
||||
// The generator is even so this is valid
|
||||
Address::new(p2tr_script_buf(<Secp256k1 as Ciphersuite>::G::GENERATOR)),
|
||||
// This uses the minimum output value allowed, as defined as a constant in bitcoin-serai
|
||||
Balance { coin: Coin::Bitcoin, amount: Amount(bitcoin_serai::wallet::DUST) },
|
||||
None,
|
||||
));
|
||||
|
||||
let change = change
|
||||
.map(<Planner as TransactionPlanner<Rpc<D>, EffectedReceivedOutputs<Rpc<D>>>>::change_address);
|
||||
|
||||
// TODO: ACP output
|
||||
BSignableTransaction::new(
|
||||
inputs.clone(),
|
||||
&payments
|
||||
|
|
Loading…
Reference in a new issue