]> Untitled Git - bdk/commit
Never delete spent utxos from the database
authorDaniela Brozzoni <danielabrozzoni@protonmail.com>
Wed, 9 Mar 2022 15:15:34 +0000 (16:15 +0100)
committerDaniela Brozzoni <danielabrozzoni@protonmail.com>
Thu, 10 Mar 2022 10:58:23 +0000 (11:58 +0100)
commitf2f0efc0b3367abf40e33b84fc577fb11f625b04
tree37b5b419ff1d5a8677bbe5c43c3771ff398c61b3
parent3e4678d8e31509679b163aa1a30c2a1a04a09b3f
Never delete spent utxos from the database

A `is_spent` field is added to LocalUtxo; when a txo is spent we set
this field to true instead of deleting the entire utxo from the
database.
This allows us to create txs double-spending txs already in blockchain.
Listunspent won't return spent utxos, effectively excluding them from the
coin selection and balance calculation
13 files changed:
CHANGELOG.md
src/blockchain/compact_filters/mod.rs
src/blockchain/rpc.rs
src/blockchain/script_sync.rs
src/database/keyvalue.rs
src/database/memory.rs
src/database/mod.rs
src/database/sqlite.rs
src/testutils/blockchain_tests.rs
src/types.rs
src/wallet/coin_selection.rs
src/wallet/mod.rs
src/wallet/tx_builder.rs