Skip to content

only add addrs relevant to the wallet

Luke Champine requested to merge relevant-addrs into master

Previously, all addresses in transactions relevant to the wallet would be added to the bucketAddrTransactions bucket, which maps addresses to the transactions they appear in. This caused problems due to the "zero address" (types.UnlockHash{}) appearing in transactions. Since miner fee outputs leave the RelatedAddress field empty (i.e. zero), the mapping for the zero address effectively maps to every transaction relevant to the wallet that has miner fees. For really high-volume wallets, like exchanges, this caused the zero address to map to over 625,000 transactions. This subsequently led to a bug where the mapping could not be decoded, as 625k * (8 bytes per mapping) is the maximum allowed size of an encoded value.

This PR fixes the issue by only adding addresses to bucketAddrTransactions if they are relevant to the wallet. This means you will no longer be able to query the AddressTransactions method for addresses not relevant to the wallet, but that seems like a non-issue, given that the wallet only stores transactions relevant to it in the first place. If you need to search for non-owned addresses, you'll have to use an explorer.

Merge request reports