lnd_test: make test use globale defaultCSV
This commit is contained in:
parent
0348db760e
commit
ec76a25530
32
lnd_test.go
32
lnd_test.go
@ -2182,7 +2182,6 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
|
||||
// TODO(roasbeef): should check default value in config here
|
||||
// instead, or make delay a param
|
||||
defaultCSV := uint32(4)
|
||||
defaultCLTV := uint32(defaultBitcoinTimeLockDelta)
|
||||
|
||||
// Since we'd like to test failure scenarios with outstanding htlcs,
|
||||
@ -5594,7 +5593,6 @@ func testFailingChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
const (
|
||||
timeout = time.Duration(time.Second * 10)
|
||||
paymentAmt = 10000
|
||||
defaultCSV = 4
|
||||
)
|
||||
|
||||
chanAmt := maxFundingAmount
|
||||
@ -6986,7 +6984,6 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
chanAmt = maxBtcFundingAmount
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
defaultCSV = uint32(4)
|
||||
)
|
||||
|
||||
// Carol will be the up-to-date party. We set --nolisten to ensure Dave
|
||||
@ -8726,7 +8723,6 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
dustHtlcAmt = btcutil.Amount(100)
|
||||
htlcAmt = btcutil.Amount(30000)
|
||||
finalCltvDelta = 40
|
||||
csvDelay = 4
|
||||
)
|
||||
alicePayStream, err := net.Alice.SendPayment(ctxb)
|
||||
if err != nil {
|
||||
@ -8816,9 +8812,9 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("htlc mismatch: %v", predErr)
|
||||
}
|
||||
|
||||
// We'll mine csvDelay blocks in order to generate the sweep transaction
|
||||
// We'll mine defaultCSV blocks in order to generate the sweep transaction
|
||||
// of Bob's funding output.
|
||||
if _, err := net.Miner.Node.Generate(csvDelay); err != nil {
|
||||
if _, err := net.Miner.Node.Generate(defaultCSV); err != nil {
|
||||
t.Fatalf("unable to generate blocks: %v", err)
|
||||
}
|
||||
|
||||
@ -8829,7 +8825,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
|
||||
// We'll now mine the remaining blocks to cause the HTLC itself to
|
||||
// timeout.
|
||||
if _, err := net.Miner.Node.Generate(defaultBroadcastDelta - csvDelay); err != nil {
|
||||
if _, err := net.Miner.Node.Generate(defaultBroadcastDelta - defaultCSV); err != nil {
|
||||
t.Fatalf("unable to generate blocks: %v", err)
|
||||
}
|
||||
|
||||
@ -8943,8 +8939,6 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
||||
timeout := time.Duration(time.Second * 15)
|
||||
ctxb := context.Background()
|
||||
|
||||
defaultCSV := uint32(4)
|
||||
|
||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||
// self.
|
||||
@ -9184,7 +9178,6 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
// to Carol. As Carol is in hodl mode, she won't settle this HTLC which
|
||||
// opens up the base for out tests.
|
||||
const (
|
||||
csvDelay = 4
|
||||
finalCltvDelta = 40
|
||||
htlcAmt = btcutil.Amount(30000)
|
||||
)
|
||||
@ -9259,9 +9252,9 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
t.Fatalf(predErr.Error())
|
||||
}
|
||||
|
||||
// We'll mine csvDelay blocks in order to generate the sweep transaction
|
||||
// We'll mine defaultCSV blocks in order to generate the sweep transaction
|
||||
// of Bob's funding output.
|
||||
if _, err := net.Miner.Node.Generate(csvDelay); err != nil {
|
||||
if _, err := net.Miner.Node.Generate(defaultCSV); err != nil {
|
||||
t.Fatalf("unable to generate blocks: %v", err)
|
||||
}
|
||||
|
||||
@ -9272,7 +9265,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
|
||||
// We'll now mine enough blocks for the HTLC to expire. After this, Bob
|
||||
// should hand off the now expired HTLC output to the utxo nursery.
|
||||
if _, err := net.Miner.Node.Generate(finalCltvDelta - csvDelay - 1); err != nil {
|
||||
if _, err := net.Miner.Node.Generate(finalCltvDelta - defaultCSV - 1); err != nil {
|
||||
t.Fatalf("unable to generate blocks: %v", err)
|
||||
}
|
||||
|
||||
@ -9377,7 +9370,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
// We'll now mine 4 additional blocks. This should be enough for Bob's
|
||||
// CSV timelock to expire and the sweeping transaction of the HTLC to be
|
||||
// broadcast.
|
||||
if _, err := net.Miner.Node.Generate(csvDelay); err != nil {
|
||||
if _, err := net.Miner.Node.Generate(defaultCSV); err != nil {
|
||||
t.Fatalf("unable to mine blocks: %v", err)
|
||||
}
|
||||
|
||||
@ -9441,7 +9434,6 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness,
|
||||
// to Carol. As Carol is in hodl mode, she won't settle this HTLC which
|
||||
// opens up the base for out tests.
|
||||
const (
|
||||
csvDelay = 4
|
||||
finalCltvDelta = 40
|
||||
htlcAmt = btcutil.Amount(30000)
|
||||
)
|
||||
@ -9641,8 +9633,6 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
||||
timeout := time.Duration(time.Second * 15)
|
||||
ctxb := context.Background()
|
||||
|
||||
defaultCSV := uint32(4)
|
||||
|
||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||
// self.
|
||||
@ -9775,7 +9765,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
||||
}
|
||||
|
||||
// Keep track of the second level tx maturity.
|
||||
carolSecondLevelCSV := defaultCSV
|
||||
carolSecondLevelCSV := uint32(defaultCSV)
|
||||
|
||||
// When Bob notices Carol's second level transaction in the block, he
|
||||
// will extract the preimage and broadcast a second level tx to claim
|
||||
@ -9850,7 +9840,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest)
|
||||
|
||||
// Keep track of Bob's second level maturity, and decrement our track
|
||||
// of Carol's.
|
||||
bobSecondLevelCSV := defaultCSV
|
||||
bobSecondLevelCSV := uint32(defaultCSV)
|
||||
carolSecondLevelCSV--
|
||||
|
||||
// If we then mine 3 additional blocks, Carol's second level tx should
|
||||
@ -9967,8 +9957,6 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
|
||||
timeout := time.Duration(time.Second * 15)
|
||||
ctxb := context.Background()
|
||||
|
||||
defaultCSV := uint32(4)
|
||||
|
||||
// First, we'll create a three hop network: Alice -> Bob -> Carol, with
|
||||
// Carol refusing to actually settle or directly cancel any HTLC's
|
||||
// self.
|
||||
@ -10123,7 +10111,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest
|
||||
}
|
||||
|
||||
// Keep track of the second level tx maturity.
|
||||
carolSecondLevelCSV := defaultCSV
|
||||
carolSecondLevelCSV := uint32(defaultCSV)
|
||||
|
||||
// When Bob notices Carol's second level transaction in the block, he
|
||||
// will extract the preimage and broadcast a sweep tx to directly claim
|
||||
|
Loading…
Reference in New Issue
Block a user