Commit Graph

3 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
eda6ed224f
sweep: add unit tests for TestDetermineFeePerKw and CraftSweepAllTx
Along the way we also extend the mockFeeEstimator to be able to return a
fee rate for a specified confirmation target.
2019-01-09 15:55:28 -08:00
Olaoluwa Osuntokun
9c29e61826
sweep: add new CraftSweepAllTx method to fully withdrawal from a wallet
In this commit, we add a new function, CraftSweepAllTx. This function
allows callers to craft a transaction which sweeps ALL outputs from the
wallet to a single target address. It can either be used for UTXO
consolidation (at the cost of privacy by co-mingling inputs), or simply
to sweep all funds out of a wallet for various reasons.

In an attempt to ensure this method is loosely coupled and testable, for
all behavior structs, we create brand new interface to accept. This
ensures that we only rely on the minimal number of methods needed to
perform our duty.
2019-01-09 15:55:23 -08:00
Olaoluwa Osuntokun
73c9c2ee15
sweep+cnct+nursery+rpc: extract DetermineFeePerKw to func, add FeePreference
In this commit, we extract the existing determineFeePerKw method on the
RPC server into a new file in the sweep package. Along the way, we
consolidate code by introducing a new FeePreference struct, which allows
the caller to express their fee preference either in blocks to
confirmation, or a direct fee rate. This move takes a small step to
father decoupling calls in the main RPC server.
2019-01-09 15:55:17 -08:00