Merge pull request #8953 from ProofOfKeags/refactor/lnwallet-channel-channel-constraints-partition

[MICRO]: multi: break ChannelConstraints into two sub-structures
This commit is contained in:
Oliver Gugger
2024-08-05 02:08:52 -06:00
committed by GitHub
15 changed files with 338 additions and 242 deletions

View File

@@ -138,24 +138,28 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
csvTimeoutBob := uint32(4)
isAliceInitiator := true
aliceConstraints := &channeldb.ChannelConstraints{
DustLimit: btcutil.Amount(200),
aliceBounds := channeldb.ChannelStateBounds{
MaxPendingAmount: lnwire.NewMSatFromSatoshis(
channelCapacity),
ChanReserve: aliceReserve,
MinHTLC: 0,
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
CsvDelay: uint16(csvTimeoutAlice),
}
aliceCommitParams := channeldb.CommitmentParams{
DustLimit: btcutil.Amount(200),
CsvDelay: uint16(csvTimeoutAlice),
}
bobConstraints := &channeldb.ChannelConstraints{
DustLimit: btcutil.Amount(800),
bobBounds := channeldb.ChannelStateBounds{
MaxPendingAmount: lnwire.NewMSatFromSatoshis(
channelCapacity),
ChanReserve: bobReserve,
MinHTLC: 0,
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
CsvDelay: uint16(csvTimeoutBob),
}
bobCommitParams := channeldb.CommitmentParams{
DustLimit: btcutil.Amount(800),
CsvDelay: uint16(csvTimeoutBob),
}
var hash [sha256.Size]byte
@@ -172,7 +176,8 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
fundingTxIn := wire.NewTxIn(prevOut, nil, nil)
aliceCfg := channeldb.ChannelConfig{
ChannelConstraints: *aliceConstraints,
ChannelStateBounds: aliceBounds,
CommitmentParams: aliceCommitParams,
MultiSigKey: keychain.KeyDescriptor{
PubKey: aliceKeyPub,
},
@@ -190,7 +195,8 @@ func createTestChannel(t *testing.T, alicePrivKey, bobPrivKey []byte,
},
}
bobCfg := channeldb.ChannelConfig{
ChannelConstraints: *bobConstraints,
ChannelStateBounds: bobBounds,
CommitmentParams: bobCommitParams,
MultiSigKey: keychain.KeyDescriptor{
PubKey: bobKeyPub,
},