bitcoin/bitcoin — pull request #3694 by gavinandresen (2014-02-17 16:46:00+00:00)
Title: Remove CWalletTx::vfSpent

Use the spent outpoint multimap to figure out which wallet transaction outputs are unspent, instead of a vfSpent array that is saved to disk.

This is simpler and more robust and will result in smaller wallet.dat files.

Careful review and testing needed. In particular, I have not (yet) simulated restoring a wallet.dat from backup and making sure it syncs correctly, and have not tested importing private keys that were used in the past or that were involved in a mutated transaction scenario.

There might also be an issue with taking a wallet.dat file produced with this change (which does not write vfSpent) and using it with an older version, although I think the old ReacceptWalletTransactions() code will behave reasonably in that case and will automatically recompute vfSpent.

I also have not tested for performance with a very large wallet (a wallet containing a very large number of transactions); I expect somebody running a service who HAS a very large wallet to step up and do that-- ideally by writing a new qa/rpc-tests/largewallet.sh regression test that creates and tests a large -regtest wallet.