multi test: update tests/mocks to use EstimateFeePerVSize
This commit is contained in:
parent
ba3f3e1942
commit
7b30425111
@ -1331,18 +1331,18 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
|
||||
}
|
||||
|
||||
estimator := &lnwallet.StaticFeeEstimator{FeeRate: 50}
|
||||
feePerWeight, err := estimator.EstimateFeePerWeight(1)
|
||||
feePerVSize, err := estimator.EstimateFeePerVSize(1)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
feePerKw := feePerWeight * 1000
|
||||
feePerKw := feePerVSize.FeePerKWeight()
|
||||
|
||||
// TODO(roasbeef): need to factor in commit fee?
|
||||
aliceCommit := channeldb.ChannelCommitment{
|
||||
CommitHeight: 0,
|
||||
LocalBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
RemoteBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
FeePerKw: feePerKw,
|
||||
FeePerKw: btcutil.Amount(feePerKw),
|
||||
CommitFee: 8688,
|
||||
CommitTx: aliceCommitTx,
|
||||
CommitSig: bytes.Repeat([]byte{1}, 71),
|
||||
@ -1351,7 +1351,7 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
|
||||
CommitHeight: 0,
|
||||
LocalBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
RemoteBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
FeePerKw: feePerKw,
|
||||
FeePerKw: btcutil.Amount(feePerKw),
|
||||
CommitFee: 8688,
|
||||
CommitTx: bobCommitTx,
|
||||
CommitSig: bytes.Repeat([]byte{1}, 71),
|
||||
|
2
mock.go
2
mock.go
@ -229,7 +229,7 @@ func (m *mockWalletController) FetchRootKey() (*btcec.PrivateKey, error) {
|
||||
return m.rootKey, nil
|
||||
}
|
||||
func (*mockWalletController) SendOutputs(outputs []*wire.TxOut,
|
||||
_ btcutil.Amount) (*chainhash.Hash, error) {
|
||||
_ lnwallet.SatPerVByte) (*chainhash.Hash, error) {
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
@ -170,11 +170,12 @@ func TestPeerChannelClosureAcceptFeeInitiator(t *testing.T) {
|
||||
}
|
||||
|
||||
estimator := lnwallet.StaticFeeEstimator{FeeRate: 50}
|
||||
feeRate, err := estimator.EstimateFeePerWeight(1)
|
||||
feeRate, err := estimator.EstimateFeePerVSize(1)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to query fee estimator: %v", err)
|
||||
}
|
||||
fee := btcutil.Amount(responderChan.CalcFee(uint64(feeRate * 1000)))
|
||||
feePerKw := feeRate.FeePerKWeight()
|
||||
fee := btcutil.Amount(responderChan.CalcFee(feePerKw))
|
||||
closeSig, _, _, err := responderChan.CreateCloseProposal(fee,
|
||||
dummyDeliveryScript, initiatorDeliveryScript)
|
||||
if err != nil {
|
||||
@ -460,12 +461,12 @@ func TestPeerChannelClosureFeeNegotiationsInitiator(t *testing.T) {
|
||||
}
|
||||
|
||||
estimator := lnwallet.StaticFeeEstimator{FeeRate: 50}
|
||||
initiatorIdealFeeRate, err := estimator.EstimateFeePerWeight(1)
|
||||
initiatorIdealFeeRate, err := estimator.EstimateFeePerVSize(1)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to query fee estimator: %v", err)
|
||||
}
|
||||
initiatorIdealFee := responderChan.CalcFee(
|
||||
uint64(initiatorIdealFeeRate * 1000),
|
||||
initiatorIdealFeeRate.FeePerKWeight(),
|
||||
)
|
||||
increasedFee := btcutil.Amount(float64(initiatorIdealFee) * 2.5)
|
||||
closeSig, _, _, err := responderChan.CreateCloseProposal(
|
||||
|
@ -138,19 +138,19 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
}
|
||||
|
||||
estimator := &lnwallet.StaticFeeEstimator{FeeRate: 50}
|
||||
feePerWeight, err := estimator.EstimateFeePerWeight(1)
|
||||
feePerVSize, err := estimator.EstimateFeePerVSize(1)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
feePerKw := feePerWeight * 1000
|
||||
feePerKw := feePerVSize.FeePerKWeight()
|
||||
|
||||
// TODO(roasbeef): need to factor in commit fee?
|
||||
aliceCommit := channeldb.ChannelCommitment{
|
||||
CommitHeight: 0,
|
||||
LocalBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
RemoteBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
FeePerKw: feePerKw,
|
||||
CommitFee: 8688,
|
||||
FeePerKw: btcutil.Amount(feePerKw),
|
||||
CommitFee: feePerKw.FeeForWeight(lnwallet.CommitWeight),
|
||||
CommitTx: aliceCommitTx,
|
||||
CommitSig: bytes.Repeat([]byte{1}, 71),
|
||||
}
|
||||
@ -158,8 +158,8 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
||||
CommitHeight: 0,
|
||||
LocalBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
RemoteBalance: lnwire.NewMSatFromSatoshis(channelBal),
|
||||
FeePerKw: feePerKw,
|
||||
CommitFee: 8688,
|
||||
FeePerKw: btcutil.Amount(feePerKw),
|
||||
CommitFee: feePerKw.FeeForWeight(lnwallet.CommitWeight),
|
||||
CommitTx: bobCommitTx,
|
||||
CommitSig: bytes.Repeat([]byte{1}, 71),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user