Commit graph

11 commits

Author SHA1 Message Date
Olaoluwa Osuntokun b0b64d3bbd multi: update due to latest API changes 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 7770cac383 multi: switch import paths back to upstream 2018-05-23 19:38:56 -07:00
Johan T. Halseth d626036401 wallet/author: use vsize when estimating fees
This commit makes use of the recently added EstimateVirtualSize
method to estimated the size of a transaction when calculating
fees. This makes fee estimation more accurate when we are spending
segwit outputs, as before we wouldn't account for the witness
descount, resulting in overshooting fee estimates.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun a0abd3632c multi: update to new upstream btcsuite/btcd API's 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 3dc7a8529c multi: switch all imports to roasbeef's forks 2018-05-23 19:38:56 -07:00
Alex e273e178dd Repoint repo to btcsuite on btcwalletln, and a few rebase fixes. 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun 77b756c651 multi: point all imports towards roasbeef's forks 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun beb3231a03 wallet/txauthor: add ability to sign for nested+normal p2wkh
This commit enabled the wallet to properly spend nested and normal
p2wkh outputs under its control.

For regular p2wkh outputs, spending simply involves presenting the
original pub key, and signature as the witness data.

For nested p2wkh outputs, in addition to the above, the version zero
witness p2wkh witness program is placed in the sigScript in order to
allow clients who are aware of BIP 16 to validate the witness spend.
2018-05-23 19:38:56 -07:00
DanielKrawisz 5e39e68778 Fix typo. (#453) 2016-08-15 11:27:32 -04:00
Josh Rickmar 7b2e1ac282 Do not include zero value change outputs.
Due to the way dust is calculated, if the transaction relay fee is
zero, then a zero output amount is not considered dust.  As the
transaction authoring code used this dust check to determine whether a
change output can be included or not, it could create unnecessary
change outputs which return no value back to the wallet.  Prevent this
by including an explicit check for zero values.
2016-04-20 10:46:12 -04:00
Josh Rickmar f084802fec Refactor wallet transaction creation code.
This began as a change to improve the fee calculation code and evolved
into a much larger refactor which improves the readability and
modularity of all of the transaction creation code.

Transaction fee calculations have been switched from full increments
of the relay fee to a proportion based on the transaction size.  This
means that for a relay fee of 1e3 satoshis/kB, a 500 byte transaction
is only required to pay a 5e2 satoshi fee and a 1500 byte transaction
only need pay a 1.5e3 fee.  The previous code would end up estimating
these fees to be 1e3 and 2e3 respectively.

Because the previous code would add more fee than needed in almost
every case, the transaction size estimations were optimistic
(best/smallest case) and signing was done in a loop where the fee was
incremented by the relay fee again each time the actual size of the
signed transaction rendered the fee too low.  This has switched to
using worst case transaction size estimates rather than best case, and
signing is only performed once.

Transaction input signature creation has switched from using
txscript.SignatureScript to txscript.SignTxOutput.  The new API is
able to redeem outputs other than just P2PKH, so the previous
restrictions about P2SH outputs being unspendable (except through the
signrawtransaction RPC) no longer hold.

Several new public packages have been added:

wallet/txauthor - transaction authoring and signing
wallet/txfees - fee estimations and change output inclusion
wallet/txrules - simple consensus and mempool policy rule checks

Along with some internal packages:

wallet/internal/txsizes - transaction size estimation
internal/helpers - context free convenience functions

The txsizes package is internal as the estimations it provides are
specific for the algorithms used by these new packages.
2016-03-08 17:42:27 -05:00