Skip to content

Add Integration Test for Sweeper Fee-Bumping to Maximum Fee Rate #9733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
Name: "send all coins",
TestFunc: testSendAllCoins,
},
{
Name: "bump fee until max reached",
Test: testBumpFeeUntilMaxReached,

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / windows itest

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / macOS itest

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

unknown field Test in struct literal of type lntest.TestCase

Check failure on line 42 in itest/list_on_test.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

unknown field Test in struct literal of type lntest.TestCase
},
{
Name: "send selected coins",
TestFunc: testSendSelectedCoins,
Expand Down
152 changes: 152 additions & 0 deletions itest/lnd_fee_bump_max.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package itest

import (
"fmt"
"strings"
"time"

"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/stretchr/testify/require"
)

// testBumpFeeUntilMaxReached tests fee-bumping a wallet transaction until the
// maximum fee rate of 100 sat/vbyte is reached.
func testBumpFeeUntilMaxReached(ht *lntest.HarnessTest) {
const (
maxFeeRate = 100 // sat/vbyte
defaultTimeout = 30 * time.Second
)

// Set up Alice with a max fee rate of 100 sat/vbyte.
args := []string{fmt.Sprintf("--sweeper.maxfeerate=%d", maxFeeRate)}
alice := ht.NewNode("Alice", args)

// Fund Alice's wallet with 1 BTC.
ht.FundCoins(btcutil.SatoshiPerBitcoin, alice)

// Create a new address for a transaction.
addrResp := alice.RPC.NewAddress(&lnrpc.NewAddressRequest{
Type: lnrpc.AddressType_WITNESS_PUBKEY_HASH,
})

// Send 0.001 BTC with a low fee rate (1 sat/vbyte) to keep it unconfirmed.
sendReq := &lnrpc.SendCoinsRequest{
Addr: addrResp.Address,
Amount: 100_000, // 0.001 BTC
SatPerByte: 1, // Low fee rate
}
txid := alice.RPC.SendCoins(sendReq).Txid

// Wait for the transaction to appear in the mempool.
waitForTxInMempool(ht, txid, defaultTimeout)

// Get the raw transaction to find an input outpoint for fee-bumping.
txHash, err := chainhash.NewHashFromStr(txid)
require.NoError(ht, err, "invalid txid")
txRaw, err := ht.Miner.Client.GetRawTransactionVerbose(txid)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 50 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)
require.NoError(ht, err, "failed to get raw tx")

// Select the first input outpoint (assumes at least one input).
require.Greater(ht, len(txRaw.Vin), 0, "no inputs in transaction")
input := txRaw.Vin[0]
op := &lnrpc.OutPoint{
TxidBytes: txHash[:],
OutputIndex: uint32(input.Vout),
}

// Calculate initial fee rate from the mempool transaction.
initialFeeRate := getTxFeeRate(ht, txHash)
ht.Logf("Initial fee rate: %d sat/vbyte", initialFeeRate)

// Bump fee repeatedly until max fee rate is reached or budget is exhausted.
bumpReq := &walletrpc.BumpFeeRequest{
Outpoint: op,
Immediate: true,
DeadlineDelta: 5,
Budget: 50_000, // Half of 0.001 BTC in satoshis
}
var currentFeeRate uint64
for i := 0; i < 20; i++ {
_, err := alice.RPC.WalletKit.BumpFee(ht.MainContext, bumpReq)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)

Check failure on line 74 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

ht.MainContext undefined (type *lntest.HarnessTest has no field or method MainContext)
if err != nil {
if strings.Contains(err.Error(), "max fee rate exceeded") ||
strings.Contains(err.Error(), "position already at max") {
ht.Logf("Stopped bumping at max fee rate")
break
}
require.NoError(ht, err, "failed to bump fee")
}

// Wait for the new transaction in the mempool.
waitForTxInMempool(ht, txid, defaultTimeout)

// Get the latest transaction spending the input outpoint.
currentFeeRate = getTxFeeRate(ht, txHash)
ht.Logf("Attempt #%d: fee rate = %d sat/vbyte", i+1, currentFeeRate)

// Stop if fee rate reaches or exceeds max or doesn't increase.
if currentFeeRate >= maxFeeRate || currentFeeRate <= initialFeeRate {
break
}
initialFeeRate = currentFeeRate
}

// Verify the final fee rate is at least the max fee rate.
require.GreaterOrEqual(ht, currentFeeRate, uint64(maxFeeRate),
"final fee rate %d sat/vbyte below max %d sat/vbyte",
currentFeeRate, maxFeeRate)

// Mine a block to confirm the transaction.
ht.MineBlocks(1)
}

// waitForTxInMempool waits until the specified txid appears in the mempool.
func waitForTxInMempool(ht *lntest.HarnessTest, txid string, timeout time.Duration) {
txHash, err := chainhash.NewHashFromStr(txid)
require.NoError(ht, err, "invalid txid")

err = wait.Predicate(func() bool {

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

undefined: wait

Check failure on line 112 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

undefined: wait
mempool, err := ht.Miner.Client.GetRawMempool()

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 113 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)
require.NoError(ht, err, "failed to get mempool")
for _, memTx := range mempool {
if memTx.IsEqual(txHash) {
return true
}
}
return false
}, timeout)
require.NoError(ht, err, "timeout waiting for tx %s in mempool", txid)
}

// getTxFeeRate retrieves the fee rate of the latest transaction spending the
// given outpoint from the mempool.
func getTxFeeRate(ht *lntest.HarnessTest, txHash *chainhash.Hash) uint64 {
// Get all mempool transactions.
mempool, err := ht.Miner.Client.GetRawMempoolVerbose()

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 129 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)
require.NoError(ht, err, "failed to get mempool")

// Find the transaction spending the given outpoint.
for txid, entry := range mempool {
txRaw, err := ht.Miner.Client.GetRawTransactionVerbose(txid)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / windows itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (btcd, backend=btcd cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (neutrino, backend=neutrino cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind, backend=bitcoind cover=1)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-rpcpolling, backend="bitcoind rpcpolling")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / macOS itest

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-etcd, backend=bitcoind dbbackend=etcd)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres-nativesql, backend=bitcoind dbbackend=postgres nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite-nativesql, backend=bitcoind dbbackend=sqlite nativesql=true)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / check commits

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / basic itests (bitcoind-notxindex, backend="bitcoind notxindex")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-sqlite, backend=bitcoind dbbackend=sqlite)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / itests (bitcoind-postgres, backend=bitcoind dbbackend=postgres)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-cover)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_postgres")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_etcd")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit tags="kvdb_sqlite")

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)

Check failure on line 134 in itest/lnd_fee_bump_max.go

View workflow job for this annotation

GitHub Actions / run unit tests (unit-race)

ht.Miner.Client undefined (type func() *miner.HarnessMiner has no field or method Client)
require.NoError(ht, err, "failed to get raw tx %s", txid)

for _, vin := range txRaw.Vin {
if vin.Txid == txHash.String() {
// Calculate fee rate: FeeSat / VSize.
feeSat := uint64(entry.Fee * btcutil.SatoshiPerBitcoin)
vsize := uint64(entry.Vsize)
if vsize == 0 {
ht.Fatalf("zero vsize for tx %s", txid)
}
return feeSat / vsize
}
}
}

ht.Fatalf("no transaction found spending outpoint %s", txHash)
return 0
}
Loading