htlcswitch: update tests to adhere to new FeeEstimator changes

This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 01:12:53 -06:00
parent 3c4a6f42fa
commit 3aabbce551
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 18 additions and 9 deletions

View File

@ -1511,10 +1511,13 @@ func TestChannelLinkBandwidthConsistency(t *testing.T) {
) )
estimator := &lnwallet.StaticFeeEstimator{ estimator := &lnwallet.StaticFeeEstimator{
FeeRate: 24, FeeRate: 24,
Confirmation: 6,
} }
feePerKw := btcutil.Amount(estimator.EstimateFeePerWeight(1) * 1000) feePerWeight, err := estimator.EstimateFeePerWeight(1)
if err != nil {
t.Fatalf("unable to query fee estimator: %v", err)
}
feePerKw := feePerWeight * 1000
htlcFee := lnwire.NewMSatFromSatoshis( htlcFee := lnwire.NewMSatFromSatoshis(
btcutil.Amount((int64(feePerKw) * lnwallet.HtlcWeight) / 1000), btcutil.Amount((int64(feePerKw) * lnwallet.HtlcWeight) / 1000),
) )
@ -1643,10 +1646,13 @@ func TestChannelLinkBandwidthConsistencyOverflow(t *testing.T) {
) )
estimator := &lnwallet.StaticFeeEstimator{ estimator := &lnwallet.StaticFeeEstimator{
FeeRate: 24, FeeRate: 24,
Confirmation: 6,
} }
feePerKw := btcutil.Amount(estimator.EstimateFeePerWeight(1) * 1000) feePerWeight, err := estimator.EstimateFeePerWeight(1)
if err != nil {
t.Fatalf("unable to query fee estimator: %v", err)
}
feePerKw := feePerWeight * 1000
addLinkHTLC := func(amt lnwire.MilliSatoshi) [32]byte { addLinkHTLC := func(amt lnwire.MilliSatoshi) [32]byte {
invoice, htlc, err := generatePayment(amt, amt, 5, mockBlob) invoice, htlc, err := generatePayment(amt, amt, 5, mockBlob)

View File

@ -172,10 +172,13 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
} }
estimator := &lnwallet.StaticFeeEstimator{ estimator := &lnwallet.StaticFeeEstimator{
FeeRate: 24, FeeRate: 24,
Confirmation: 6,
} }
feePerKw := btcutil.Amount(estimator.EstimateFeePerWeight(1) * 1000) feePerWeight, err := estimator.EstimateFeePerWeight(1)
if err != nil {
return nil, nil, nil, nil, err
}
feePerKw := btcutil.Amount(feePerWeight * 1000)
commitFee := (feePerKw * btcutil.Amount(724)) / 1000 commitFee := (feePerKw * btcutil.Amount(724)) / 1000
const broadcastHeight = 1 const broadcastHeight = 1