Skip to content

Conversation

@bhandras
Copy link
Member

@bhandras bhandras commented Jul 8, 2022

This PR extends the swapsserverrpc.MuSig2SignSweepReq with the sweep txn's psbt to make server side validation of the sighash possible.

@bhandras bhandras requested review from guggero and sputn1ck July 8, 2022 13:13
Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful change! LGTM 🚀

@bhandras bhandras force-pushed the musig2-sweep-psbt branch 2 times, most recently from 8c171b0 to 180284c Compare July 8, 2022 17:21
Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

I think just for completeness' sake we should add the UTXO information to the packet, even though it isn't strictly needed.

sweep/sweeper.go Outdated
Version: 2,
TxIn: []*wire.TxIn{{
PreviousOutPoint: htlcOutpoint,
SignatureScript: htlc.SigScript,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are np2wkh HTLCs still supported? Otherwise we could scrap the SignatureScript.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Value: int64(amount),
PkScript: htlc.PkScript,
},
packet, err := psbt.NewFromUnsignedTx(sweepTx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set the WitnessUtxo field on the input as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@bhandras bhandras force-pushed the musig2-sweep-psbt branch from 180284c to 53ae5a2 Compare July 11, 2022 18:51
In this commit we deprecate the sighash field from the
MuSig2SignSweepReq request in favour of using a psbt serialized sweep
transaction instead. This way the sever gains full transparency about
client sweep requests and can assemble the sighash to sign on its own.
@bhandras bhandras force-pushed the musig2-sweep-psbt branch from 53ae5a2 to f8da106 Compare July 12, 2022 17:54
@bhandras bhandras merged commit 34644bd into lightninglabs:master Jul 14, 2022
@bhandras bhandras deleted the musig2-sweep-psbt branch September 12, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants