lntest: fix rescan test to show correct behavior

Now that we have patched the btcwallet version to the one that includes
the fix, we can adjust the rescan test to show the correct and expected
behavior.
This commit is contained in:
Oliver Gugger 2022-12-08 11:48:54 +01:00
parent 5e851912a7
commit f26a9a84d7
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -355,18 +355,15 @@ func testRescanAddressDetection(ht *lntemp.HarnessTest) {
// Make sure we see the change output in our list of unspent outputs.
// We _don't_ expect to see the ghost UTXO here as in this step it's
// ignored as an internal address correctly.
// TODO(guggero): This is incorrect, should only be 1 UTXO.
ht.AssertNumUTXOsConfirmed(carol, 2)
ht.AssertNumUTXOsConfirmed(carol, 1)
unspent := carol.RPC.ListUnspent(&walletrpc.ListUnspentRequest{
MinConfs: 1,
})
// Which one was the change output and which one the ghost UTXO output?
var ghostUtxoIndex uint32
if unspent.Utxos[0].Address == ghostUtxoAddr.String() {
ghostUtxoIndex = unspent.Utxos[0].Outpoint.OutputIndex
} else {
ghostUtxoIndex = unspent.Utxos[1].Outpoint.OutputIndex
if unspent.Utxos[0].Outpoint.OutputIndex == 0 {
ghostUtxoIndex = 1
}
ghostUtxoHash, err := chainhash.NewHash(
@ -442,6 +439,5 @@ func testRescanAddressDetection(ht *lntemp.HarnessTest) {
// There should now still only be a single UTXO from the change output
// instead of two (the ghost UTXO should be missing if the fix works).
// TODO(guggero): This is incorrect, should only be 1 UTXO.
ht.AssertNumUTXOsConfirmed(carol, 2)
ht.AssertNumUTXOsConfirmed(carol, 1)
}