itest: fix testUnconfirmedChannelFunding for neutrino
This test was previously working because we'd mine an extra block to confirm the coins inside `FundCoinsUnconfirmed` when it's a neutrino backend, as shown in https://github.com/lightningnetwork/lnd/blob/fdd28c8d888792ea8fde3c557ba9f2594e0a6ec8/lntest/harness.go#L1431 Since neutrino has trouble seeing unconfirmed balance, we now send some coins to the wallet, confirm those, then do a self-transfer so the node will have unconfirmed outputs to perform the test.
This commit is contained in:
1 file changed
+19
-5
@@ -291,6 +291,24 @@ func testUnconfirmedChannelFunding(ht *lntest.HarnessTest) {
|
|||||||
// We'll send her some unconfirmed funds.
|
// We'll send her some unconfirmed funds.
|
||||||
ht.FundCoinsUnconfirmed(2*chanAmt, carol)
|
ht.FundCoinsUnconfirmed(2*chanAmt, carol)
|
||||||
|
|
||||||
|
// For neutrino backend, we will confirm the coins sent above and let
|
||||||
|
// Carol send all her funds to herself to create unconfirmed output.
|
||||||
|
if ht.IsNeutrinoBackend() {
|
||||||
|
// Confirm the above coins.
|
||||||
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
|
||||||
|
// Create a new address and send to herself.
|
||||||
|
resp := carol.RPC.NewAddress(&lnrpc.NewAddressRequest{
|
||||||
|
Type: lnrpc.AddressType_TAPROOT_PUBKEY,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Once sent, Carol would have one unconfirmed UTXO.
|
||||||
|
carol.RPC.SendCoins(&lnrpc.SendCoinsRequest{
|
||||||
|
Addr: resp.Address,
|
||||||
|
SendAll: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Now, we'll connect her to Alice so that they can open a channel
|
// Now, we'll connect her to Alice so that they can open a channel
|
||||||
// together. The funding flow should select Carol's unconfirmed output
|
// together. The funding flow should select Carol's unconfirmed output
|
||||||
// as she doesn't have any other funds since it's a new node.
|
// as she doesn't have any other funds since it's a new node.
|
||||||
@@ -361,11 +379,7 @@ func testUnconfirmedChannelFunding(ht *lntest.HarnessTest) {
|
|||||||
// parties. For neutrino backend, the funding transaction should be
|
// parties. For neutrino backend, the funding transaction should be
|
||||||
// mined. Otherwise, two transactions should be mined, the unconfirmed
|
// mined. Otherwise, two transactions should be mined, the unconfirmed
|
||||||
// spend and the funding tx.
|
// spend and the funding tx.
|
||||||
if ht.IsNeutrinoBackend() {
|
ht.MineBlocksAndAssertNumTxes(6, 2)
|
||||||
ht.MineBlocksAndAssertNumTxes(6, 1)
|
|
||||||
} else {
|
|
||||||
ht.MineBlocksAndAssertNumTxes(6, 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
chanPoint := ht.WaitForChannelOpenEvent(chanOpenUpdate)
|
chanPoint := ht.WaitForChannelOpenEvent(chanOpenUpdate)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user