mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-27 18:22:24 +01:00
lnwallet: refactor test code for HTLC add and recv
This commit is contained in:
parent
1cd4fdc859
commit
43ab85b874
@ -22,6 +22,7 @@ import (
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
@ -49,6 +50,18 @@ func createHTLC(id int, amount lnwire.MilliSatoshi) (*lnwire.UpdateAddHTLC, [32]
|
||||
}, returnPreimage
|
||||
}
|
||||
|
||||
// addAndReceiveHTLC adds an HTLC as local to the first channel, and as remote
|
||||
// to a second channel. The HTLC ID is not modified.
|
||||
func addAndReceiveHTLC(t *testing.T, channel1, channel2 *LightningChannel,
|
||||
htlc *lnwire.UpdateAddHTLC, openKey *models.CircuitKey) {
|
||||
|
||||
_, err := channel1.AddHTLC(htlc, openKey)
|
||||
require.NoErrorf(t, err, "channel 1 unable to add htlc: %v", err)
|
||||
|
||||
_, err = channel2.ReceiveHTLC(htlc)
|
||||
require.NoErrorf(t, err, "channel 2 unable to recv htlc: %v", err)
|
||||
}
|
||||
|
||||
func assertOutputExistsByValue(t *testing.T, commitTx *wire.MsgTx,
|
||||
value btcutil.Amount) {
|
||||
|
||||
@ -435,10 +448,7 @@ func TestChannelZeroAddLocalHeight(t *testing.T) {
|
||||
htlc, _ := createHTLC(0, lnwire.MilliSatoshi(500000))
|
||||
|
||||
// -----add----->
|
||||
_, err = aliceChannel.AddHTLC(htlc, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Force a state transition to lock in this add on both commitments.
|
||||
// -----sig----->
|
||||
@ -484,10 +494,7 @@ func TestChannelZeroAddLocalHeight(t *testing.T) {
|
||||
htlc2, _ := createHTLC(0, lnwire.MilliSatoshi(500000))
|
||||
|
||||
// <----add-----
|
||||
_, err = bobChannel.AddHTLC(htlc2, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = newAliceChannel.ReceiveHTLC(htlc2)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, newAliceChannel, htlc2, nil)
|
||||
|
||||
// Bob should now send a commitment signature to Alice.
|
||||
// <----sig-----
|
||||
@ -544,12 +551,7 @@ func TestCheckCommitTxSize(t *testing.T) {
|
||||
for i := 0; i <= 10; i++ {
|
||||
htlc, _ := createHTLC(i, lnwire.MilliSatoshi(1e7))
|
||||
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("bob unable to receive htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete state update: %v", err)
|
||||
@ -624,12 +626,7 @@ func testCommitHTLCSigTieBreak(t *testing.T, restart bool) {
|
||||
Expiry: uint32(numHtlcs - i),
|
||||
}
|
||||
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("bob unable to receive htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
}
|
||||
|
||||
// Have Alice initiate the first half of the commitment dance. The
|
||||
@ -873,23 +870,13 @@ func testForceClose(t *testing.T, testCase *forceCloseTestCase) {
|
||||
// We'll ensure that the HTLC amount is above Alice's dust limit.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
// We'll also a distinct HTLC from Bob -> Alice. This way, Alice will
|
||||
// have both an incoming and outgoing HTLC on her commitment
|
||||
// transaction.
|
||||
htlcBob, preimageBob := createHTLC(0, htlcAmount)
|
||||
if _, err := bobChannel.AddHTLC(htlcBob, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := aliceChannel.ReceiveHTLC(htlcBob); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlcBob, nil)
|
||||
|
||||
// Next, we'll perform two state transitions to ensure that both HTLC's
|
||||
// get fully locked-in.
|
||||
@ -1343,12 +1330,7 @@ func TestDustHTLCFees(t *testing.T) {
|
||||
// This HTLC amount should be lower than the dust limits of both nodes.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(100)
|
||||
htlc, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("bob unable to receive htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("Can't update the channel state: %v", err)
|
||||
}
|
||||
@ -1501,14 +1483,9 @@ func TestHTLCSigNumber(t *testing.T) {
|
||||
for i, htlcSat := range htlcValues {
|
||||
htlcMsat := lnwire.NewMSatFromSatoshis(htlcSat)
|
||||
htlc, _ := createHTLC(i, htlcMsat)
|
||||
_, err := aliceChannel.AddHTLC(htlc, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
_, err = bobChannel.ReceiveHTLC(htlc)
|
||||
if err != nil {
|
||||
t.Fatalf("bob unable to receive htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(
|
||||
t, aliceChannel, bobChannel, htlc, nil,
|
||||
)
|
||||
}
|
||||
|
||||
return aliceChannel, bobChannel
|
||||
@ -1742,12 +1719,7 @@ func TestStateUpdatePersistence(t *testing.T) {
|
||||
OnionBlob: fakeOnionBlob,
|
||||
}
|
||||
|
||||
if _, err := aliceChannel.AddHTLC(h, nil); err != nil {
|
||||
t.Fatalf("unable to add alice's htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(h); err != nil {
|
||||
t.Fatalf("unable to recv alice's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, h, nil)
|
||||
}
|
||||
rHash := sha256.Sum256(bobPreimage[:])
|
||||
bobh := &lnwire.UpdateAddHTLC{
|
||||
@ -1756,12 +1728,7 @@ func TestStateUpdatePersistence(t *testing.T) {
|
||||
Expiry: uint32(10),
|
||||
OnionBlob: fakeOnionBlob,
|
||||
}
|
||||
if _, err := bobChannel.AddHTLC(bobh, nil); err != nil {
|
||||
t.Fatalf("unable to add bob's htlc: %v", err)
|
||||
}
|
||||
if _, err := aliceChannel.ReceiveHTLC(bobh); err != nil {
|
||||
t.Fatalf("unable to recv bob's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, bobh, nil)
|
||||
|
||||
// Also add a fee update to the update logs.
|
||||
fee := chainfee.SatPerKWeight(333)
|
||||
@ -2410,12 +2377,7 @@ func TestUpdateFeeConcurrentSig(t *testing.T) {
|
||||
// First Alice adds the outgoing HTLC to her local channel's state
|
||||
// update log. Then Alice sends this wire message over to Bob who
|
||||
// adds this htlc to his remote state update log.
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Simulate Alice sending update fee message to bob.
|
||||
fee := chainfee.SatPerKWeight(333)
|
||||
@ -2485,12 +2447,7 @@ func TestUpdateFeeSenderCommits(t *testing.T) {
|
||||
// First Alice adds the outgoing HTLC to her local channel's state
|
||||
// update log. Then Alice sends this wire message over to Bob who
|
||||
// adds this htlc to his remote state update log.
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Simulate Alice sending update fee message to bob.
|
||||
fee := chainfee.SatPerKWeight(333)
|
||||
@ -2594,12 +2551,7 @@ func TestUpdateFeeReceiverCommits(t *testing.T) {
|
||||
// First Alice adds the outgoing HTLC to her local channel's state
|
||||
// update log. Then Alice sends this wire message over to Bob who
|
||||
// adds this htlc to his remote state update log.
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Simulate Alice sending update fee message to bob
|
||||
fee := chainfee.SatPerKWeight(333)
|
||||
@ -3792,12 +3744,7 @@ func testChanSyncOweRevocation(t *testing.T, chanType channeldb.ChannelType) {
|
||||
Amount: htlcAmt,
|
||||
Expiry: uint32(10),
|
||||
}
|
||||
if _, err := aliceChannel.AddHTLC(aliceHtlc, nil); err != nil {
|
||||
t.Fatalf("unable to add alice's htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(aliceHtlc); err != nil {
|
||||
t.Fatalf("unable to recv alice's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, aliceHtlc, nil)
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete alice's state transition: %v", err)
|
||||
}
|
||||
@ -4086,10 +4033,7 @@ func testChanSyncOweRevocationAndCommitForceTransition(t *testing.T,
|
||||
Expiry: uint32(10),
|
||||
ID: 1,
|
||||
}
|
||||
_, err = bobChannel.AddHTLC(bobHtlc[1], nil)
|
||||
require.NoError(t, err, "unable to add bob's htlc")
|
||||
_, err = aliceChannel.ReceiveHTLC(bobHtlc[1])
|
||||
require.NoError(t, err, "unable to recv bob's htlc")
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, bobHtlc[1], nil)
|
||||
|
||||
// Bob signs the new state update, and sends the signature to Alice.
|
||||
bobNewCommit, err := bobChannel.SignNextCommitment()
|
||||
@ -4322,14 +4266,7 @@ func TestChanSyncFailure(t *testing.T) {
|
||||
}
|
||||
index++
|
||||
|
||||
_, err := bobChannel.AddHTLC(bobHtlc, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to add bob's htlc: %v", err)
|
||||
}
|
||||
_, err = aliceChannel.ReceiveHTLC(bobHtlc)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to recv bob's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, bobHtlc, nil)
|
||||
err = ForceStateTransition(bobChannel, aliceChannel)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to complete bob's state "+
|
||||
@ -4355,14 +4292,7 @@ func TestChanSyncFailure(t *testing.T) {
|
||||
}
|
||||
index++
|
||||
|
||||
_, err := bobChannel.AddHTLC(bobHtlc, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to add bob's htlc: %v", err)
|
||||
}
|
||||
_, err = aliceChannel.ReceiveHTLC(bobHtlc)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to recv bob's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, bobHtlc, nil)
|
||||
|
||||
aliceNewCommit, err := aliceChannel.SignNextCommitment()
|
||||
if err != nil {
|
||||
@ -4705,12 +4635,7 @@ func TestChannelRetransmissionFeeUpdate(t *testing.T) {
|
||||
Amount: lnwire.NewMSatFromSatoshis(20000),
|
||||
Expiry: uint32(10),
|
||||
}
|
||||
if _, err := bobChannel.AddHTLC(bobHtlc, nil); err != nil {
|
||||
t.Fatalf("unable to add bob's htlc: %v", err)
|
||||
}
|
||||
if _, err := aliceChannel.ReceiveHTLC(bobHtlc); err != nil {
|
||||
t.Fatalf("unable to recv bob's htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, bobHtlc, nil)
|
||||
if err := ForceStateTransition(bobChannel, aliceChannel); err != nil {
|
||||
t.Fatalf("unable to complete bob's state transition: %v", err)
|
||||
}
|
||||
@ -4782,12 +4707,7 @@ func TestFeeUpdateOldDiskFormat(t *testing.T) {
|
||||
var htlcs []*lnwire.UpdateAddHTLC
|
||||
for i := 0; i < numHTLCs; i++ {
|
||||
htlc, _ := createHTLC(i, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
htlcs = append(htlcs, htlc)
|
||||
|
||||
if i%5 != 0 {
|
||||
@ -4896,12 +4816,7 @@ func TestFeeUpdateOldDiskFormat(t *testing.T) {
|
||||
// Finally, to trigger a compactLogs execution, we'll add a new HTLC,
|
||||
// then force a state transition.
|
||||
htlc, _ := createHTLC(numHTLCs, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete bob's state transition: %v", err)
|
||||
}
|
||||
@ -4995,12 +4910,7 @@ func TestChanSyncInvalidLastSecret(t *testing.T) {
|
||||
Amount: htlcAmt,
|
||||
Expiry: uint32(5),
|
||||
}
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Then we'll initiate a state transition to lock in this new HTLC.
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
@ -5122,12 +5032,7 @@ func TestChanAvailableBandwidth(t *testing.T) {
|
||||
alicePreimages := make([][32]byte, numHtlcs)
|
||||
for i := 0; i < numHtlcs; i++ {
|
||||
htlc, preImage := createHTLC(i, dustAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
alicePreimages[i] = preImage
|
||||
}
|
||||
@ -5140,12 +5045,7 @@ func TestChanAvailableBandwidth(t *testing.T) {
|
||||
htlcAmt := lnwire.NewMSatFromSatoshis(30000)
|
||||
for i := 0; i < numHtlcs; i++ {
|
||||
htlc, preImage := createHTLC(numHtlcs+i, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
alicePreimages = append(alicePreimages, preImage)
|
||||
}
|
||||
@ -5414,13 +5314,7 @@ func TestChanCommitWeightDustHtlcs(t *testing.T) {
|
||||
t.Helper()
|
||||
|
||||
htlc, preImage := createHTLC(int(htlcIndex), htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete alice's state "+
|
||||
"transition: %v", err)
|
||||
@ -5553,19 +5447,10 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
|
||||
// a state transition.
|
||||
var htlcAmt lnwire.MilliSatoshi = 100000
|
||||
htlc, _ := createHTLC(0, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
htlc2, _ := createHTLC(1, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc2, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc2: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc2); err != nil {
|
||||
t.Fatalf("unable to recv htlc2: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc2, nil)
|
||||
|
||||
// We'll now manually initiate a state transition between Alice and
|
||||
// bob.
|
||||
@ -5853,12 +5738,7 @@ func TestInvalidCommitSigError(t *testing.T) {
|
||||
// Alice to Bob.
|
||||
var htlcAmt lnwire.MilliSatoshi = 100000
|
||||
htlc, _ := createHTLC(0, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Alice will now attempt to initiate a state transition.
|
||||
aliceNewCommit, err := aliceChannel.SignNextCommitment()
|
||||
@ -5903,19 +5783,9 @@ func TestChannelUnilateralCloseHtlcResolution(t *testing.T) {
|
||||
// initiating enough state transitions to lock both of them in.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
htlcBob, preimageBob := createHTLC(0, htlcAmount)
|
||||
if _, err := bobChannel.AddHTLC(htlcBob, nil); err != nil {
|
||||
t.Fatalf("bob unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := aliceChannel.ReceiveHTLC(htlcBob); err != nil {
|
||||
t.Fatalf("alice unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlcBob, nil)
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("Can't update the channel state: %v", err)
|
||||
}
|
||||
@ -6059,12 +5929,7 @@ func TestChannelUnilateralClosePendingCommit(t *testing.T) {
|
||||
// create a new state transition.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
// With the HTLC added, we'll now manually initiate a state transition
|
||||
// from Alice to Bob.
|
||||
@ -6258,12 +6123,7 @@ func TestMaxAcceptedHTLCs(t *testing.T) {
|
||||
// Send the maximum allowed number of HTLCs.
|
||||
for i := 0; i < numHTLCs; i++ {
|
||||
htlc, _ := createHTLC(i, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Just assign htlcID to the last received HTLC.
|
||||
htlcID = htlc.ID
|
||||
@ -6302,12 +6162,7 @@ func TestMaxAcceptedHTLCs(t *testing.T) {
|
||||
// failed. We use numHTLCs here since the previous AddHTLC with this index
|
||||
// failed.
|
||||
htlc, _ = createHTLC(numHTLCs, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Add a commitment to Bob's commitment chain.
|
||||
aliceNewCommit, err := aliceChannel.SignNextCommitment()
|
||||
@ -6383,12 +6238,7 @@ func TestMaxAsynchronousHtlcs(t *testing.T) {
|
||||
// Send the maximum allowed number of HTLCs minus one.
|
||||
for i := 0; i < numHTLCs-1; i++ {
|
||||
htlc, _ := createHTLC(i, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Just assign htlcID to the last received HTLC.
|
||||
htlcID = htlc.ID
|
||||
@ -6400,12 +6250,7 @@ func TestMaxAsynchronousHtlcs(t *testing.T) {
|
||||
|
||||
// Send an HTLC to Bob so that Bob's commitment transaction is full.
|
||||
htlc, _ := createHTLC(numHTLCs-1, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Fail back an HTLC and sign a commitment as in steps 1 & 2.
|
||||
err = bobChannel.FailHTLC(htlcID, []byte{}, nil, nil, nil)
|
||||
@ -6444,12 +6289,7 @@ func TestMaxAsynchronousHtlcs(t *testing.T) {
|
||||
|
||||
// Send the final Add which should succeed as in step 6.
|
||||
htlc, _ = createHTLC(numHTLCs, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Receiving the commitment should succeed as in step 7 since space was
|
||||
// made.
|
||||
@ -6490,12 +6330,7 @@ func TestMaxPendingAmount(t *testing.T) {
|
||||
htlcAmt := lnwire.NewMSatFromSatoshis(1.5 * btcutil.SatoshiPerBitcoin)
|
||||
for i := 0; i < numHTLCs; i++ {
|
||||
htlc, _ := createHTLC(i, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
}
|
||||
|
||||
// We finally add one more HTLC of 0.1 BTC to Alice's commitment. This
|
||||
@ -6597,12 +6432,7 @@ func TestChanReserve(t *testing.T) {
|
||||
htlcAmt := lnwire.NewMSatFromSatoshis(0.5 * btcutil.SatoshiPerBitcoin)
|
||||
htlc, _ := createHTLC(aliceIndex, htlcAmt)
|
||||
aliceIndex++
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Force a state transition, making sure this HTLC is considered valid
|
||||
// even though the channel reserves are not met.
|
||||
@ -6649,12 +6479,7 @@ func TestChanReserve(t *testing.T) {
|
||||
// The first HTLC should successfully be sent.
|
||||
htlc, _ = createHTLC(aliceIndex, htlcAmt)
|
||||
aliceIndex++
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Add a second HTLC of 1 BTC. This should fail because it will take
|
||||
// Alice's balance all the way down to her channel reserve, but since
|
||||
@ -6720,12 +6545,7 @@ func TestChanReserve(t *testing.T) {
|
||||
htlcAmt = lnwire.NewMSatFromSatoshis(1 * btcutil.SatoshiPerBitcoin)
|
||||
htlc, _ = createHTLC(bobIndex, htlcAmt)
|
||||
bobIndex++
|
||||
if _, err := bobChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := aliceChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc, nil)
|
||||
|
||||
// Do a last state transition, which should succeed.
|
||||
if err := ForceStateTransition(bobChannel, aliceChannel); err != nil {
|
||||
@ -6853,12 +6673,7 @@ func TestMinHTLC(t *testing.T) {
|
||||
// ErrBelowMinHTLC.
|
||||
htlcAmt := lnwire.NewMSatFromSatoshis(0.5 * btcutil.SatoshiPerBitcoin)
|
||||
htlc, _ := createHTLC(0, htlcAmt)
|
||||
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
|
||||
t.Fatalf("unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
|
||||
t.Fatalf("unable to recv htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// We add an HTLC below the min value, this should result in
|
||||
// an ErrBelowMinHTLC error.
|
||||
@ -7099,12 +6914,7 @@ func TestChannelRestoreUpdateLogs(t *testing.T) {
|
||||
// Bob's commit, but not on Alice's.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
// Let Alice sign a new state, which will include the HTLC just sent.
|
||||
aliceNewCommit, err := aliceChannel.SignNextCommitment()
|
||||
@ -7345,11 +7155,7 @@ func TestDuplicateFailRejection(t *testing.T) {
|
||||
// parties.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
_, err = bobChannel.ReceiveHTLC(htlcAlice)
|
||||
require.NoError(t, err, "unable to recv htlc")
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete state update: %v", err)
|
||||
@ -7412,11 +7218,7 @@ func TestDuplicateSettleRejection(t *testing.T) {
|
||||
// parties.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||
htlcAlice, alicePreimage := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
_, err = bobChannel.ReceiveHTLC(htlcAlice)
|
||||
require.NoError(t, err, "unable to recv htlc")
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
if err := ForceStateTransition(aliceChannel, bobChannel); err != nil {
|
||||
t.Fatalf("unable to complete state update: %v", err)
|
||||
@ -7518,12 +7320,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
|
||||
// We'll send an HtLC from Alice to Bob.
|
||||
htlcAmount := lnwire.NewMSatFromSatoshis(100000000)
|
||||
htlcAlice, _ := createHTLC(0, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
// Let Alice sign a new state, which will include the HTLC just sent.
|
||||
aliceNewCommit, err := aliceChannel.SignNextCommitment()
|
||||
@ -7587,12 +7384,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
|
||||
// existing HTLCs (the HTLC with index 0) keep getting the add heights
|
||||
// restored properly.
|
||||
htlcAlice, _ = createHTLC(1, htlcAmount)
|
||||
if _, err := aliceChannel.AddHTLC(htlcAlice, nil); err != nil {
|
||||
t.Fatalf("alice unable to add htlc: %v", err)
|
||||
}
|
||||
if _, err := bobChannel.ReceiveHTLC(htlcAlice); err != nil {
|
||||
t.Fatalf("bob unable to recv add htlc: %v", err)
|
||||
}
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlcAlice, nil)
|
||||
|
||||
// Send a new signature from Alice to Bob, making Alice have a pending
|
||||
// remote commitment.
|
||||
@ -9522,10 +9314,7 @@ func TestChannelUnsignedAckedFailure(t *testing.T) {
|
||||
htlc, _ := createHTLC(0, lnwire.MilliSatoshi(500000))
|
||||
|
||||
// -----add----->
|
||||
_, err = aliceChannel.AddHTLC(htlc, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Force a state transition to lock in this add on both commitments.
|
||||
// -----sig----->
|
||||
@ -9585,10 +9374,7 @@ func TestChannelUnsignedAckedFailure(t *testing.T) {
|
||||
htlc2, _ := createHTLC(0, lnwire.MilliSatoshi(500000))
|
||||
|
||||
// <----add------
|
||||
_, err = bobChannel.AddHTLC(htlc2, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = newAliceChannel.ReceiveHTLC(htlc2)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, newAliceChannel, htlc2, nil)
|
||||
|
||||
// Bob sends the final signature to Alice and Alice should not
|
||||
// reject it, given that we properly restore the unsigned acked
|
||||
@ -9632,10 +9418,7 @@ func TestChannelLocalUnsignedUpdatesFailure(t *testing.T) {
|
||||
htlc, _ := createHTLC(0, lnwire.MilliSatoshi(500000))
|
||||
|
||||
// <----add-----
|
||||
_, err = bobChannel.AddHTLC(htlc, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc, nil)
|
||||
|
||||
// Force a state transition to lock in this add on both commitments.
|
||||
// <----sig-----
|
||||
@ -9719,10 +9502,7 @@ func TestChannelSignedAckRegression(t *testing.T) {
|
||||
htlc, preimage := createHTLC(0, lnwire.MilliSatoshi(5000000))
|
||||
|
||||
// <----add------
|
||||
_, err = bobChannel.AddHTLC(htlc, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc, nil)
|
||||
|
||||
// Force a state transition to lock in the HTLC.
|
||||
// <----sig------
|
||||
@ -9761,10 +9541,7 @@ func TestChannelSignedAckRegression(t *testing.T) {
|
||||
htlc2, _ := createHTLC(0, lnwire.MilliSatoshi(5000000))
|
||||
|
||||
// -----add---->
|
||||
_, err = aliceChannel.AddHTLC(htlc2, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc2)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc2, nil)
|
||||
|
||||
// -----sig---->
|
||||
aliceNewCommit, err = aliceChannel.SignNextCommitment()
|
||||
@ -9861,10 +9638,7 @@ func TestIsChannelClean(t *testing.T) {
|
||||
// sends an htlc.
|
||||
// ---add--->
|
||||
htlc, preimage := createHTLC(0, lnwire.MilliSatoshi(5000000))
|
||||
_, err = aliceChannel.AddHTLC(htlc, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
assertCleanOrDirty(false, aliceChannel, bobChannel, t)
|
||||
|
||||
// Assert that the channel remains dirty until the HTLC is completely
|
||||
@ -10038,10 +9812,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
|
||||
htlc1Amt := lnwire.MilliSatoshi(700_000)
|
||||
htlc1, preimage1 := createHTLC(0, htlc1Amt)
|
||||
|
||||
_, err = bobChannel.AddHTLC(htlc1, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc1)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc1, nil)
|
||||
|
||||
// Assert that GetDustSum from Alice's perspective does not consider
|
||||
// the HTLC dust on her commitment, but does on Bob's commitment.
|
||||
@ -10081,10 +9852,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
|
||||
htlc2Amt := lnwire.MilliSatoshi(100_000)
|
||||
htlc2, _ := createHTLC(0, htlc2Amt)
|
||||
|
||||
_, err = aliceChannel.AddHTLC(htlc2, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc2)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc2, nil)
|
||||
|
||||
// Assert that GetDustSum from Alice's perspective includes the new
|
||||
// HTLC as dust on both commitments.
|
||||
@ -10132,10 +9900,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
|
||||
htlc3Amt := lnwire.MilliSatoshi(400_000)
|
||||
htlc3, _ := createHTLC(1, htlc3Amt)
|
||||
|
||||
_, err = aliceChannel.AddHTLC(htlc3, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc3)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc3, nil)
|
||||
|
||||
// Assert that this new HTLC is not counted on Alice's local commitment
|
||||
// in the dust sum. Bob's commitment should count it.
|
||||
@ -11118,11 +10883,7 @@ func TestAsynchronousSendingWithFeeBuffer(t *testing.T) {
|
||||
aliceChannel.channelState.LocalChanCfg.DustLimit + htlcFee,
|
||||
)
|
||||
htlc3, _ := createHTLC(1, htlcAmt3)
|
||||
_, err = bobChannel.AddHTLC(htlc3, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc3)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc3, nil)
|
||||
|
||||
err = ForceStateTransition(bobChannel, aliceChannel)
|
||||
require.NoError(t, err)
|
||||
@ -11228,10 +10989,7 @@ func TestEnforceFeeBuffer(t *testing.T) {
|
||||
// --------------- |-----rev------>
|
||||
htlc1, _ := createHTLC(0, lnwire.NewMSatFromSatoshis(htlcAmt1))
|
||||
|
||||
_, err = aliceChannel.AddHTLC(htlc1, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc1)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc1, nil)
|
||||
|
||||
err = ForceStateTransition(aliceChannel, bobChannel)
|
||||
require.NoError(t, err)
|
||||
@ -11245,10 +11003,7 @@ func TestEnforceFeeBuffer(t *testing.T) {
|
||||
htlcAmt2 := lnwire.NewMSatFromSatoshis(btcutil.SatoshiPerBitcent)
|
||||
htlc2, _ := createHTLC(0, htlcAmt2)
|
||||
|
||||
_, err = bobChannel.AddHTLC(htlc2, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc2)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc2, nil)
|
||||
|
||||
err = ForceStateTransition(bobChannel, aliceChannel)
|
||||
require.NoError(t, err)
|
||||
@ -11268,10 +11023,7 @@ func TestEnforceFeeBuffer(t *testing.T) {
|
||||
// <----rev------- |---------------
|
||||
htlc4, _ := createHTLC(1, htlcAmt2)
|
||||
|
||||
_, err = bobChannel.AddHTLC(htlc4, nil)
|
||||
require.NoError(t, err)
|
||||
_, err = aliceChannel.ReceiveHTLC(htlc4)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, bobChannel, aliceChannel, htlc4, nil)
|
||||
|
||||
err = ForceStateTransition(bobChannel, aliceChannel)
|
||||
require.NoError(t, err)
|
||||
@ -11311,11 +11063,7 @@ func TestBlindingPointPersistence(t *testing.T) {
|
||||
tlv.NewPrimitiveRecord[lnwire.BlindingPointTlvType](blinding),
|
||||
)
|
||||
|
||||
_, err = aliceChannel.AddHTLC(htlc, nil)
|
||||
|
||||
require.NoError(t, err)
|
||||
_, err = bobChannel.ReceiveHTLC(htlc)
|
||||
require.NoError(t, err)
|
||||
addAndReceiveHTLC(t, aliceChannel, bobChannel, htlc, nil)
|
||||
|
||||
// Now, Alice will send a new commitment to Bob, which will persist our
|
||||
// pending HTLC to disk.
|
||||
|
Loading…
x
Reference in New Issue
Block a user