Skip to content

Commit

Permalink
Merge #813: db: check for change using address strings only
Browse files Browse the repository at this point in the history
79c5f92 db: check for change using address strings only (jp1ac4)

Pull request description:

  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.

ACKs for top commit:
  darosior:
    utACK 79c5f92

Tree-SHA512: 50c87a6feac3f659584e92ad8781092bf513d63a590453f87d8617ec4b309ec3128050e6c10114d0150e08a373d4d1824a99b2530ab82eb5b14dd3790ec15237
  • Loading branch information
darosior committed Nov 15, 2023
2 parents 44f5a85 + 79c5f92 commit e0fba88
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
})
}
Expand Down

0 comments on commit e0fba88

Please sign in to comment.