lnwallet: update test due to recent API changes
This commit is contained in:
parent
98cba87fb1
commit
661f27a404
@ -292,8 +292,12 @@ func createTestChannels(revocationWindow int) (*LightningChannel, *LightningChan
|
|||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
estimator := &StaticFeeEstimator{24, 6}
|
estimator := &StaticFeeEstimator{24}
|
||||||
feePerKw := btcutil.Amount(estimator.EstimateFeePerWeight(1) * 1000)
|
feePerWeight, err := estimator.EstimateFeePerWeight(1)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, err
|
||||||
|
}
|
||||||
|
feePerKw := feePerWeight * 1000
|
||||||
commitFee := calcStaticFee(0)
|
commitFee := calcStaticFee(0)
|
||||||
|
|
||||||
aliceCommit := channeldb.ChannelCommitment{
|
aliceCommit := channeldb.ChannelCommitment{
|
||||||
@ -797,8 +801,8 @@ func TestCooperativeChannelClosure(t *testing.T) {
|
|||||||
|
|
||||||
// We'll store with both Alice and Bob creating a new close proposal
|
// We'll store with both Alice and Bob creating a new close proposal
|
||||||
// with the same fee.
|
// with the same fee.
|
||||||
aliceFee := aliceChannel.CalcFee(aliceFeeRate)
|
aliceFee := btcutil.Amount(aliceChannel.CalcFee(aliceFeeRate))
|
||||||
aliceSig, _, err := aliceChannel.CreateCloseProposal(
|
aliceSig, err := aliceChannel.CreateCloseProposal(
|
||||||
aliceFee, aliceDeliveryScript, bobDeliveryScript,
|
aliceFee, aliceDeliveryScript, bobDeliveryScript,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -806,8 +810,8 @@ func TestCooperativeChannelClosure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
aliceCloseSig := append(aliceSig, byte(txscript.SigHashAll))
|
aliceCloseSig := append(aliceSig, byte(txscript.SigHashAll))
|
||||||
|
|
||||||
bobFee := bobChannel.CalcFee(bobFeeRate)
|
bobFee := btcutil.Amount(bobChannel.CalcFee(bobFeeRate))
|
||||||
bobSig, _, err := bobChannel.CreateCloseProposal(
|
bobSig, err := bobChannel.CreateCloseProposal(
|
||||||
bobFee, bobDeliveryScript, aliceDeliveryScript,
|
bobFee, bobDeliveryScript, aliceDeliveryScript,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1803,16 +1807,16 @@ func TestCooperativeCloseDustAdherence(t *testing.T) {
|
|||||||
// Both sides currently have over 1 BTC settled as part of their
|
// Both sides currently have over 1 BTC settled as part of their
|
||||||
// balances. As a result, performing a cooperative closure now result
|
// balances. As a result, performing a cooperative closure now result
|
||||||
// in both sides having an output within the closure transaction.
|
// in both sides having an output within the closure transaction.
|
||||||
aliceFee := aliceChannel.CalcFee(aliceFeeRate)
|
aliceFee := btcutil.Amount(aliceChannel.CalcFee(aliceFeeRate))
|
||||||
aliceSig, _, err := aliceChannel.CreateCloseProposal(aliceFee,
|
aliceSig, err := aliceChannel.CreateCloseProposal(aliceFee,
|
||||||
aliceDeliveryScript, bobDeliveryScript)
|
aliceDeliveryScript, bobDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
}
|
}
|
||||||
aliceCloseSig := append(aliceSig, byte(txscript.SigHashAll))
|
aliceCloseSig := append(aliceSig, byte(txscript.SigHashAll))
|
||||||
|
|
||||||
bobFee := bobChannel.CalcFee(bobFeeRate)
|
bobFee := btcutil.Amount(bobChannel.CalcFee(bobFeeRate))
|
||||||
bobSig, _, err := bobChannel.CreateCloseProposal(bobFee,
|
bobSig, err := bobChannel.CreateCloseProposal(bobFee,
|
||||||
bobDeliveryScript, aliceDeliveryScript)
|
bobDeliveryScript, aliceDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
@ -1843,14 +1847,14 @@ func TestCooperativeCloseDustAdherence(t *testing.T) {
|
|||||||
|
|
||||||
// Attempt another cooperative channel closure. It should succeed
|
// Attempt another cooperative channel closure. It should succeed
|
||||||
// without any issues.
|
// without any issues.
|
||||||
aliceSig, _, err = aliceChannel.CreateCloseProposal(aliceFee,
|
aliceSig, err = aliceChannel.CreateCloseProposal(aliceFee,
|
||||||
aliceDeliveryScript, bobDeliveryScript)
|
aliceDeliveryScript, bobDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
}
|
}
|
||||||
aliceCloseSig = append(aliceSig, byte(txscript.SigHashAll))
|
aliceCloseSig = append(aliceSig, byte(txscript.SigHashAll))
|
||||||
|
|
||||||
bobSig, _, err = bobChannel.CreateCloseProposal(bobFee,
|
bobSig, err = bobChannel.CreateCloseProposal(bobFee,
|
||||||
bobDeliveryScript, aliceDeliveryScript)
|
bobDeliveryScript, aliceDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
@ -1883,14 +1887,14 @@ func TestCooperativeCloseDustAdherence(t *testing.T) {
|
|||||||
|
|
||||||
// Our final attempt at another cooperative channel closure. It should
|
// Our final attempt at another cooperative channel closure. It should
|
||||||
// succeed without any issues.
|
// succeed without any issues.
|
||||||
aliceSig, _, err = aliceChannel.CreateCloseProposal(aliceFee,
|
aliceSig, err = aliceChannel.CreateCloseProposal(aliceFee,
|
||||||
aliceDeliveryScript, bobDeliveryScript)
|
aliceDeliveryScript, bobDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
}
|
}
|
||||||
aliceCloseSig = append(aliceSig, byte(txscript.SigHashAll))
|
aliceCloseSig = append(aliceSig, byte(txscript.SigHashAll))
|
||||||
|
|
||||||
bobSig, _, err = bobChannel.CreateCloseProposal(bobFee,
|
bobSig, err = bobChannel.CreateCloseProposal(bobFee,
|
||||||
bobDeliveryScript, aliceDeliveryScript)
|
bobDeliveryScript, aliceDeliveryScript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to close channel: %v", err)
|
t.Fatalf("unable to close channel: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user