From 79c5f92d9c690c36308a9d3fa4b35a4c4f6e01d4 Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:24:35 +0000 Subject: [PATCH] db: check for change using address strings only Comparing the address itself includes the network, but an unchecked signet address will have its network set as testnet by `assume_checked` and so change addresses will not be matched. --- src/database/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index d0349405f..6d275a96d 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -243,7 +243,10 @@ impl DatabaseConnection for SqliteConn { self.db_address(address).map(|db_addr| { ( db_addr.derivation_index, - address == &db_addr.change_address.assume_checked(), + // We only compare address strings in case `assume_checked()` uses a different network. + // E.g. An unchecked signet address would have its network set to testnet and so comparing + // to a signet `Address` would never match. + address.to_string() == db_addr.change_address.assume_checked().to_string(), ) }) }