mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-04 08:50:20 +02:00
lntest: reflect the updated fee estimator in tests
This commit is contained in:
parent
1870caf39c
commit
519a8749ef
@ -324,6 +324,7 @@ func sweepNodeWalletAndAssert(ht *lntest.HarnessTest, node *node.HarnessNode) {
|
|||||||
node.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
node.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
||||||
Addr: minerAddr.String(),
|
Addr: minerAddr.String(),
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Ensures we don't leave any transaction in the mempool after sweeping.
|
// Ensures we don't leave any transaction in the mempool after sweeping.
|
||||||
|
@ -85,6 +85,7 @@ func coopCloseWithHTLCs(ht *lntest.HarnessTest) {
|
|||||||
closeClient := alice.RPC.CloseChannel(&lnrpc.CloseChannelRequest{
|
closeClient := alice.RPC.CloseChannel(&lnrpc.CloseChannelRequest{
|
||||||
ChannelPoint: chanPoint,
|
ChannelPoint: chanPoint,
|
||||||
NoWait: true,
|
NoWait: true,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
ht.AssertChannelInactive(bob, chanPoint)
|
ht.AssertChannelInactive(bob, chanPoint)
|
||||||
|
|
||||||
@ -184,6 +185,7 @@ func coopCloseWithHTLCsWithRestart(ht *lntest.HarnessTest) {
|
|||||||
ChannelPoint: chanPoint,
|
ChannelPoint: chanPoint,
|
||||||
NoWait: true,
|
NoWait: true,
|
||||||
DeliveryAddress: newAddr.Address,
|
DeliveryAddress: newAddr.Address,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Assert that both nodes see the channel as waiting for close.
|
// Assert that both nodes see the channel as waiting for close.
|
||||||
|
@ -530,6 +530,7 @@ func sendAllCoinsConfirm(ht *lntest.HarnessTest, node *node.HarnessNode,
|
|||||||
sweepReq := &lnrpc.SendCoinsRequest{
|
sweepReq := &lnrpc.SendCoinsRequest{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
node.RPC.SendCoins(sweepReq)
|
node.RPC.SendCoins(sweepReq)
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
@ -781,6 +781,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Addr: ainz.RPC.GetInfo().IdentityPubkey,
|
Addr: ainz.RPC.GetInfo().IdentityPubkey,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Ensure that we can't send coins to another user's Pubkey.
|
// Ensure that we can't send coins to another user's Pubkey.
|
||||||
@ -788,6 +789,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Addr: ht.Alice.RPC.GetInfo().IdentityPubkey,
|
Addr: ht.Alice.RPC.GetInfo().IdentityPubkey,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// With the two coins above mined, we'll now instruct Ainz to sweep all
|
// With the two coins above mined, we'll now instruct Ainz to sweep all
|
||||||
@ -802,6 +804,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Addr: "tb1qfc8fusa98jx8uvnhzavxccqlzvg749tvjw82tg",
|
Addr: "tb1qfc8fusa98jx8uvnhzavxccqlzvg749tvjw82tg",
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Send coins to a mainnet address.
|
// Send coins to a mainnet address.
|
||||||
@ -809,6 +812,15 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Addr: "1MPaXKp5HhsLNjVSqaL7fChE3TVyrTMRT3",
|
Addr: "1MPaXKp5HhsLNjVSqaL7fChE3TVyrTMRT3",
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Send coins to a compatible address without specifying fee rate or
|
||||||
|
// conf target.
|
||||||
|
ainz.RPC.SendCoinsAssertErr(&lnrpc.SendCoinsRequest{
|
||||||
|
Addr: ht.Miner.NewMinerAddress().String(),
|
||||||
|
SendAll: true,
|
||||||
|
Label: sendCoinsLabel,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Send coins to a compatible address.
|
// Send coins to a compatible address.
|
||||||
@ -816,6 +828,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Addr: ht.Miner.NewMinerAddress().String(),
|
Addr: ht.Miner.NewMinerAddress().String(),
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// We'll mine a block which should include the sweep transaction we
|
// We'll mine a block which should include the sweep transaction we
|
||||||
@ -916,6 +929,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
Amount: 10000,
|
Amount: 10000,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
Label: sendCoinsLabel,
|
Label: sendCoinsLabel,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// With all the edge cases tested, we'll now test the happy paths of
|
// With all the edge cases tested, we'll now test the happy paths of
|
||||||
@ -943,6 +957,7 @@ func testSweepAllCoins(ht *lntest.HarnessTest) {
|
|||||||
resp := ainz.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
resp := ainz.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
||||||
Addr: mainAddrResp.Address,
|
Addr: mainAddrResp.Address,
|
||||||
Amount: amt,
|
Amount: amt,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
block := ht.MineBlocksAndAssertNumTxes(1, 1)[0]
|
block := ht.MineBlocksAndAssertNumTxes(1, 1)[0]
|
||||||
sweepTx := block.Transactions[1]
|
sweepTx := block.Transactions[1]
|
||||||
@ -1025,6 +1040,7 @@ func testListAddresses(ht *lntest.HarnessTest) {
|
|||||||
Addr: addr,
|
Addr: addr,
|
||||||
Amount: addressDetail.Balance,
|
Amount: addressDetail.Balance,
|
||||||
SpendUnconfirmed: true,
|
SpendUnconfirmed: true,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +242,7 @@ func runCPFP(ht *lntest.HarnessTest, alice, bob *node.HarnessNode) {
|
|||||||
sendReq := &lnrpc.SendCoinsRequest{
|
sendReq := &lnrpc.SendCoinsRequest{
|
||||||
Addr: resp.Address,
|
Addr: resp.Address,
|
||||||
Amount: btcutil.SatoshiPerBitcoin,
|
Amount: btcutil.SatoshiPerBitcoin,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(sendReq)
|
alice.RPC.SendCoins(sendReq)
|
||||||
txid := ht.Miner.AssertNumTxsInMempool(1)[0]
|
txid := ht.Miner.AssertNumTxsInMempool(1)[0]
|
||||||
@ -385,6 +386,7 @@ func testAnchorReservedValue(ht *lntest.HarnessTest) {
|
|||||||
sweepReq := &lnrpc.SendCoinsRequest{
|
sweepReq := &lnrpc.SendCoinsRequest{
|
||||||
Addr: resp.Address,
|
Addr: resp.Address,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(sweepReq)
|
alice.RPC.SendCoins(sweepReq)
|
||||||
|
|
||||||
@ -434,6 +436,7 @@ func testAnchorReservedValue(ht *lntest.HarnessTest) {
|
|||||||
sweepReq = &lnrpc.SendCoinsRequest{
|
sweepReq = &lnrpc.SendCoinsRequest{
|
||||||
Addr: minerAddr.String(),
|
Addr: minerAddr.String(),
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(sweepReq)
|
alice.RPC.SendCoins(sweepReq)
|
||||||
|
|
||||||
@ -471,6 +474,7 @@ func testAnchorReservedValue(ht *lntest.HarnessTest) {
|
|||||||
sweepReq = &lnrpc.SendCoinsRequest{
|
sweepReq = &lnrpc.SendCoinsRequest{
|
||||||
Addr: minerAddr.String(),
|
Addr: minerAddr.String(),
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(sweepReq)
|
alice.RPC.SendCoins(sweepReq)
|
||||||
|
|
||||||
@ -602,6 +606,7 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
|
|||||||
sweepReq := &lnrpc.SendCoinsRequest{
|
sweepReq := &lnrpc.SendCoinsRequest{
|
||||||
Addr: minerAddr.String(),
|
Addr: minerAddr.String(),
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
MinConfs: 0,
|
MinConfs: 0,
|
||||||
SpendUnconfirmed: true,
|
SpendUnconfirmed: true,
|
||||||
}
|
}
|
||||||
@ -757,6 +762,7 @@ func testRemoveTx(ht *lntest.HarnessTest) {
|
|||||||
sendReq := &lnrpc.SendCoinsRequest{
|
sendReq := &lnrpc.SendCoinsRequest{
|
||||||
Addr: resp.Address,
|
Addr: resp.Address,
|
||||||
Amount: initialWalletAmt / 2,
|
Amount: initialWalletAmt / 2,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(sendReq)
|
alice.RPC.SendCoins(sendReq)
|
||||||
txID := ht.Miner.AssertNumTxsInMempool(1)[0]
|
txID := ht.Miner.AssertNumTxsInMempool(1)[0]
|
||||||
|
@ -1539,6 +1539,7 @@ func sendAllCoinsToAddrType(ht *lntest.HarnessTest,
|
|||||||
Addr: resp.Address,
|
Addr: resp.Address,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
SpendUnconfirmed: true,
|
SpendUnconfirmed: true,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
@ -256,6 +256,7 @@ func testOnchainFundRecovery(ht *lntest.HarnessTest) {
|
|||||||
req := &lnrpc.SendCoinsRequest{
|
req := &lnrpc.SendCoinsRequest{
|
||||||
Addr: minerAddr.String(),
|
Addr: minerAddr.String(),
|
||||||
Amount: minerAmt,
|
Amount: minerAmt,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
resp := node.RPC.SendCoins(req)
|
resp := node.RPC.SendCoins(req)
|
||||||
|
|
||||||
|
@ -291,6 +291,7 @@ func assertSignOutputRaw(ht *lntest.HarnessTest,
|
|||||||
req := &lnrpc.SendCoinsRequest{
|
req := &lnrpc.SendCoinsRequest{
|
||||||
Addr: targetAddr.String(),
|
Addr: targetAddr.String(),
|
||||||
Amount: 800_000,
|
Amount: 800_000,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(req)
|
alice.RPC.SendCoins(req)
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ func testTaprootSendCoinsKeySpendBip86(ht *lntest.HarnessTest,
|
|||||||
alice.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
alice.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
||||||
Addr: p2trResp.Address,
|
Addr: p2trResp.Address,
|
||||||
Amount: 0.5 * btcutil.SatoshiPerBitcoin,
|
Amount: 0.5 * btcutil.SatoshiPerBitcoin,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
txid := ht.Miner.AssertNumTxsInMempool(1)[0]
|
txid := ht.Miner.AssertNumTxsInMempool(1)[0]
|
||||||
@ -127,6 +128,7 @@ func testTaprootSendCoinsKeySpendBip86(ht *lntest.HarnessTest,
|
|||||||
alice.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
alice.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
||||||
Addr: p2trResp.Address,
|
Addr: p2trResp.Address,
|
||||||
SendAll: true,
|
SendAll: true,
|
||||||
|
TargetConf: 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Make sure the coins sent to the address are confirmed correctly,
|
// Make sure the coins sent to the address are confirmed correctly,
|
||||||
@ -154,6 +156,7 @@ func testTaprootComputeInputScriptKeySpendBip86(ht *lntest.HarnessTest,
|
|||||||
req := &lnrpc.SendCoinsRequest{
|
req := &lnrpc.SendCoinsRequest{
|
||||||
Addr: p2trAddr.String(),
|
Addr: p2trAddr.String(),
|
||||||
Amount: testAmount,
|
Amount: testAmount,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
alice.RPC.SendCoins(req)
|
alice.RPC.SendCoins(req)
|
||||||
|
|
||||||
@ -1471,6 +1474,7 @@ func sendToTaprootOutput(ht *lntest.HarnessTest, hn *node.HarnessNode,
|
|||||||
req := &lnrpc.SendCoinsRequest{
|
req := &lnrpc.SendCoinsRequest{
|
||||||
Addr: tapScriptAddr.String(),
|
Addr: tapScriptAddr.String(),
|
||||||
Amount: testAmount,
|
Amount: testAmount,
|
||||||
|
TargetConf: 6,
|
||||||
}
|
}
|
||||||
hn.RPC.SendCoins(req)
|
hn.RPC.SendCoins(req)
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
|
"github.com/lightningnetwork/lnd/fn"
|
||||||
"github.com/lightningnetwork/lnd/kvdb/etcd"
|
"github.com/lightningnetwork/lnd/kvdb/etcd"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc"
|
"github.com/lightningnetwork/lnd/lnrpc"
|
||||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||||
@ -922,6 +923,10 @@ type OpenChannelParams struct {
|
|||||||
// virtual byte of the transaction.
|
// virtual byte of the transaction.
|
||||||
SatPerVByte btcutil.Amount
|
SatPerVByte btcutil.Amount
|
||||||
|
|
||||||
|
// ConfTarget is the number of blocks that the funding transaction
|
||||||
|
// should be confirmed in.
|
||||||
|
ConfTarget fn.Option[int32]
|
||||||
|
|
||||||
// CommitmentType is the commitment type that should be used for the
|
// CommitmentType is the commitment type that should be used for the
|
||||||
// channel to be opened.
|
// channel to be opened.
|
||||||
CommitmentType lnrpc.CommitmentType
|
CommitmentType lnrpc.CommitmentType
|
||||||
@ -992,18 +997,27 @@ func (h *HarnessTest) prepareOpenChannel(srcNode, destNode *node.HarnessNode,
|
|||||||
minConfs = 0
|
minConfs = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the requested conf target. If not set, default to 6.
|
||||||
|
confTarget := p.ConfTarget.UnwrapOr(6)
|
||||||
|
|
||||||
|
// If there's fee rate set, unset the conf target.
|
||||||
|
if p.SatPerVByte != 0 {
|
||||||
|
confTarget = 0
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the request.
|
// Prepare the request.
|
||||||
return &lnrpc.OpenChannelRequest{
|
return &lnrpc.OpenChannelRequest{
|
||||||
NodePubkey: destNode.PubKey[:],
|
NodePubkey: destNode.PubKey[:],
|
||||||
LocalFundingAmount: int64(p.Amt),
|
LocalFundingAmount: int64(p.Amt),
|
||||||
PushSat: int64(p.PushAmt),
|
PushSat: int64(p.PushAmt),
|
||||||
Private: p.Private,
|
Private: p.Private,
|
||||||
|
TargetConf: confTarget,
|
||||||
MinConfs: minConfs,
|
MinConfs: minConfs,
|
||||||
SpendUnconfirmed: p.SpendUnconfirmed,
|
SpendUnconfirmed: p.SpendUnconfirmed,
|
||||||
MinHtlcMsat: int64(p.MinHtlc),
|
MinHtlcMsat: int64(p.MinHtlc),
|
||||||
RemoteMaxHtlcs: uint32(p.RemoteMaxHtlcs),
|
RemoteMaxHtlcs: uint32(p.RemoteMaxHtlcs),
|
||||||
FundingShim: p.FundingShim,
|
FundingShim: p.FundingShim,
|
||||||
SatPerByte: int64(p.SatPerVByte),
|
SatPerVbyte: uint64(p.SatPerVByte),
|
||||||
CommitmentType: p.CommitmentType,
|
CommitmentType: p.CommitmentType,
|
||||||
ZeroConf: p.ZeroConf,
|
ZeroConf: p.ZeroConf,
|
||||||
ScidAlias: p.ScidAlias,
|
ScidAlias: p.ScidAlias,
|
||||||
@ -1210,6 +1224,11 @@ func (h *HarnessTest) CloseChannelAssertPending(hn *node.HarnessNode,
|
|||||||
NoWait: true,
|
NoWait: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For coop close, we use a default confg target of 6.
|
||||||
|
if !force {
|
||||||
|
closeReq.TargetConf = 6
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
stream rpc.CloseChanClient
|
stream rpc.CloseChanClient
|
||||||
event *lnrpc.CloseStatusUpdate
|
event *lnrpc.CloseStatusUpdate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user