From 013ca40746ba26db5635c7fcc95aec60f839d620 Mon Sep 17 00:00:00 2001 From: Ononiwu Maureen <59079323+Chinwendu20@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:37:06 +0100 Subject: [PATCH] itest: Update itest This commit updates the itest to check if past pub key events would be detected on importing to a new node. Signed-off-by: Ononiwu Maureen <59079323+Chinwendu20@users.noreply.github.com> --- itest/lnd_wallet_import_test.go | 42 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/itest/lnd_wallet_import_test.go b/itest/lnd_wallet_import_test.go index d8fa84dce4..b205b55d80 100644 --- a/itest/lnd_wallet_import_test.go +++ b/itest/lnd_wallet_import_test.go @@ -709,6 +709,23 @@ func testWalletImportPubKeyScenario(ht *lntest.HarnessTest, importPubKey := func(keyIndex uint32, prevConfBalance, prevUnconfBalance int64) { + // We'll also generate the same address for Carol, as it'll be + // required later when signing. + carolAddrResp := carol.RPC.NewAddress(&lnrpc.NewAddressRequest{ + Type: walletToLNAddrType(ht.T, addrType), + }) + + // Send coins to Carol's address and confirm them, making sure + // the balance updates accordingly. + req := &lnrpc.SendCoinsRequest{ + Addr: carolAddrResp.Address, + Amount: utxoAmt, + SatPerByte: 1, + } + alice.RPC.SendCoins(req) + + ht.MineBlocksAndAssertNumTxes(1, 1) + // Retrieve Carol's account public key for the corresponding // address type. listReq := &walletrpc.ListAccountsRequest{ @@ -745,29 +762,14 @@ func testWalletImportPubKeyScenario(ht *lntest.HarnessTest, importReq := &walletrpc.ImportPublicKeyRequest{ PublicKey: serializedPubKey, AddressType: addrType, + Rescan: true, } dave.RPC.ImportPublicKey(importReq) - // We'll also generate the same address for Carol, as it'll be - // required later when signing. - carolAddrResp := carol.RPC.NewAddress(&lnrpc.NewAddressRequest{ - Type: walletToLNAddrType(ht.T, addrType), - }) - - // Send coins to Carol's address and confirm them, making sure - // the balance updates accordingly. - req := &lnrpc.SendCoinsRequest{ - Addr: carolAddrResp.Address, - Amount: utxoAmt, - SatPerByte: 1, - } - alice.RPC.SendCoins(req) - - ht.AssertWalletAccountBalance( - dave, defaultImportedAccount, prevConfBalance, - prevUnconfBalance+utxoAmt, - ) - ht.MineBlocksAndAssertNumTxes(1, 1) + // ht.AssertWalletAccountBalance( + // dave, defaultImportedAccount, prevConfBalance, + // prevUnconfBalance+utxoAmt, + // ) ht.AssertWalletAccountBalance( dave, defaultImportedAccount, prevConfBalance+utxoAmt, prevUnconfBalance,