mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-23 17:59:41 +02:00
multi: upgrade new taproot TLVs to use tlv.OptionalRecordT
In this commit, we update new Taproot related TLVs (nonces, partial sig, sig with nonce, etc). Along the way we were able to get rid of some boiler plate, but most importantly, we're able to better protect against API misuse (using a nonce that isn't initialized, etc) with the new options API. In some areas this introduces a bit of extra boiler plate, and where applicable I used some new helper functions to help cut down on the noise. Note to reviewers: this is done as a single commit, as changing the API breaks all callers, so if we want things to compile it needs to be in a wumbo commit.
This commit is contained in:
@@ -541,11 +541,9 @@ func TestTaprootFastClose(t *testing.T) {
|
||||
require.True(t, oShutdown.IsSome())
|
||||
require.True(t, oClosingSigned.IsNone())
|
||||
|
||||
bobShutdown := oShutdown.UnsafeFromSome()
|
||||
|
||||
// Alice should process the shutdown message, and create a closing
|
||||
// signed of her own.
|
||||
oShutdown, err = aliceCloser.ReceiveShutdown(bobShutdown)
|
||||
oShutdown, err = aliceCloser.ReceiveShutdown(oShutdown.UnwrapOrFail(t))
|
||||
require.NoError(t, err)
|
||||
oClosingSigned, err = aliceCloser.BeginNegotiation()
|
||||
require.NoError(t, err)
|
||||
@@ -554,7 +552,7 @@ func TestTaprootFastClose(t *testing.T) {
|
||||
require.True(t, oShutdown.IsNone())
|
||||
require.True(t, oClosingSigned.IsSome())
|
||||
|
||||
aliceClosingSigned := oClosingSigned.UnsafeFromSome()
|
||||
aliceClosingSigned := oClosingSigned.UnwrapOrFail(t)
|
||||
|
||||
// Next, Bob will process the closing signed message, and send back a
|
||||
// new one that should match exactly the offer Alice sent.
|
||||
@@ -564,7 +562,7 @@ func TestTaprootFastClose(t *testing.T) {
|
||||
require.NotNil(t, tx)
|
||||
require.True(t, oClosingSigned.IsSome())
|
||||
|
||||
bobClosingSigned := oClosingSigned.UnsafeFromSome()
|
||||
bobClosingSigned := oClosingSigned.UnwrapOrFail(t)
|
||||
|
||||
// At this point, Bob has accepted the offer, so he can broadcast the
|
||||
// closing transaction, and considers the channel closed.
|
||||
@@ -597,7 +595,7 @@ func TestTaprootFastClose(t *testing.T) {
|
||||
require.NotNil(t, tx)
|
||||
require.True(t, oClosingSigned.IsSome())
|
||||
|
||||
aliceClosingSigned = oClosingSigned.UnsafeFromSome()
|
||||
aliceClosingSigned = oClosingSigned.UnwrapOrFail(t)
|
||||
|
||||
// Alice should now also broadcast her closing transaction.
|
||||
_, err = lnutils.RecvOrTimeout(broadcastSignal, time.Second*1)
|
||||
|
Reference in New Issue
Block a user