lnwallet: pass chan cfgs to CreateCommitTx
Instead of passing delays and dustlimits separately, we pass the correct channel config to CreateCommitTx from the POV of the local party that owns the commit tx. To make it more clear which commitment we are actually creating, we rename variables to denote local and remote, to prepare for the case when both outputs might be delayed.
This commit is contained in:
3 files changed
+70
-43
No files matched your search
@@ -1015,7 +1015,7 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
||||
fakeFundingTxIn := wire.NewTxIn(fundingOut, nil, nil)
|
||||
|
||||
const channelBalance = btcutil.Amount(1 * 10e8)
|
||||
const csvTimeout = uint32(5)
|
||||
const csvTimeout = 5
|
||||
|
||||
// We also set up set some resources for the commitment transaction.
|
||||
// Each side currently has 1 BTC within the channel, with a total
|
||||
@@ -1050,6 +1050,20 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
||||
Privkeys: []*btcec.PrivateKey{aliceKeyPriv},
|
||||
}
|
||||
|
||||
aliceChanCfg := &channeldb.ChannelConfig{
|
||||
ChannelConstraints: channeldb.ChannelConstraints{
|
||||
DustLimit: DefaultDustLimit(),
|
||||
CsvDelay: csvTimeout,
|
||||
},
|
||||
}
|
||||
|
||||
bobChanCfg := &channeldb.ChannelConfig{
|
||||
ChannelConstraints: channeldb.ChannelConstraints{
|
||||
DustLimit: DefaultDustLimit(),
|
||||
CsvDelay: csvTimeout,
|
||||
},
|
||||
}
|
||||
|
||||
// With all the test data set up, we create the commitment transaction.
|
||||
// We only focus on a single party's transactions, as the scripts are
|
||||
// identical with the roles reversed.
|
||||
@@ -1063,8 +1077,8 @@ func testSpendValidation(t *testing.T, tweakless bool) {
|
||||
NoDelayKey: bobPayKey,
|
||||
}
|
||||
commitmentTx, err := CreateCommitTx(
|
||||
*fakeFundingTxIn, keyRing, csvTimeout, channelBalance,
|
||||
channelBalance, DefaultDustLimit(),
|
||||
*fakeFundingTxIn, keyRing, aliceChanCfg, bobChanCfg,
|
||||
channelBalance, channelBalance,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create commitment transaction: %v", nil)
|
||||
|
||||
Reference in new issue
Block a user