Skip to content

Commit

Permalink
itest: Update itest
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chinwendu20 authored and kaloudis committed Dec 18, 2024
1 parent 0622f29 commit 013ca40
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions itest/lnd_wallet_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 013ca40

Please sign in to comment.