Skip to content

Commit 5cd6c0c

Browse files
committed
sweepbatcher: coopSignBatchTx accepts wire.MsgTx
... instead of psbt.Packet. Make the code simpler. Function worked with packet.UnsignedTx only, so it is easier to pass tx directly.
1 parent ff144c7 commit 5cd6c0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sweepbatcher/sweep_batch.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ func (b *batch) publishBatchCoop(ctx context.Context) (btcutil.Amount,
10421042

10431043
// Attempt to cooperatively sign the batch tx with the server.
10441044
err = b.coopSignBatchTx(
1045-
ctx, packet, sweeps, prevOuts, psbtBuf.Bytes(),
1045+
ctx, batchTx, sweeps, prevOuts, psbtBuf.Bytes(),
10461046
)
10471047
if err != nil {
10481048
return fee, err, false
@@ -1084,21 +1084,21 @@ func (b *batch) debugLogTx(msg string, tx *wire.MsgTx) {
10841084

10851085
// coopSignBatchTx collects the necessary signatures from the server in order
10861086
// to cooperatively sweep the funds.
1087-
func (b *batch) coopSignBatchTx(ctx context.Context, packet *psbt.Packet,
1087+
func (b *batch) coopSignBatchTx(ctx context.Context, tx *wire.MsgTx,
10881088
sweeps []sweep, prevOuts map[wire.OutPoint]*wire.TxOut,
10891089
psbt []byte) error {
10901090

10911091
for i, sweep := range sweeps {
10921092
sweep := sweep
10931093

10941094
finalSig, err := b.musig2sign(
1095-
ctx, i, sweep, packet.UnsignedTx, prevOuts, psbt,
1095+
ctx, i, sweep, tx, prevOuts, psbt,
10961096
)
10971097
if err != nil {
10981098
return err
10991099
}
11001100

1101-
packet.UnsignedTx.TxIn[i].Witness = wire.TxWitness{
1101+
tx.TxIn[i].Witness = wire.TxWitness{
11021102
finalSig,
11031103
}
11041104
}

0 commit comments

Comments
 (0)