Commit graph

10 commits

Author SHA1 Message Date
Neil Booth
75b3ecee49 Add coin chooser to try and minimize loss of privacy. 2015-12-09 22:20:23 +09:00
Neil Booth
e302dbc71c Move debug output to end of function. 2015-11-29 18:10:17 +09:00
Neil Booth
9a6dcf7b1e Use bucketing to choose coins
Bucketing is generalization of coin chooser logic that makes it easy
to implement other algorithms.

- Put core coin chooser functionality in base class.
- Specialize derived class to implement classic electrum algorithm of
  oldest coins first.  One bucket per output.

No intended change in behaviour.
Coin chooser now sorts the coins as it wants; remove redundant sorting
from get_spendable_coins().
2015-11-29 17:59:36 +09:00
Neil Booth
93bb09230c Track tx size directly; calculate fees from that
This has several advantages.  Fee calculation is now very fast,
as we don't need to keep reserializing the tx.  Another is that
we can reason about the fees after adding a change output without
having to add it, recalculate the tx fee, and remove it again.
2015-11-29 15:40:11 +09:00
Neil Booth
a4dd5acc48 Prepare to calculate tx fee given a tx size 2015-11-29 12:41:54 +09:00
Neil Booth
530dc16ed2 Remove unused import 2015-11-28 22:14:24 +09:00
Neil Booth
8785b65a1f Remove need for coin chooser to take a wallet 2015-11-28 22:12:20 +09:00
Neil Booth
a6ea9a0c71 Simplify interface to make_tx in coin chooser
Makes the coin chooser code simpler and easier to understand.
2015-11-28 22:08:00 +09:00
Neil Booth
90dee43998 Move estimated_fee to Transaction class
It's not a function of the wallet but of the transaction
so it more naturally belongs there.
2015-11-28 21:28:54 +09:00
Neil Booth
e9061ea371 Move coin choosing logic to own class
This contains no change in logic, but is preparation for cleanup
and possible alternative strategies.
2015-11-28 14:49:10 +09:00