Add all standard TXO types to bitcoin-tx#8883
Conversation
|
Windows builds are failing: |
c23fa1d to
ca0f851
Compare
|
Concept ACK New warning: |
ca0f851 to
f6bbe64
Compare
|
Thanks @paveljanik . Fixed in squashed commit. |
|
I'll read the changes later tonight. |
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
Why do you sometimes translate dot at the end of sentence and sometimes not?
There was a problem hiding this comment.
for some reason I get a compile error when I put the dot in the sentence:
bitcoin-tx.cpp:79:13: error: expected ')'
_("Optionally add the \"W\" flag to produce a pay-to-witness-pubkey-hash output") + ". " +
^
bitcoin-tx.cpp:78:35: note: to match this '('
strUsage += HelpMessageOpt("outpubkey=VALUE:PUBKEY[:FLAGS]", _("Add pay-to-pubkey output to TX. ")
^
1 error generated.
src/bitcoin-tx.cpp
Outdated
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
This adds another dependency on boost. But as we already use it in this file, it is OK. And definitely looks better ;-)
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
$ grep "Extract and validate VALUE" bitcoin-tx.cpp
// Extract and validate VALUE
// Extract and validate VALUE
// Extract and validate VALUE
$
What about adding some function for this and share the code in all instances?
|
Concept ACK. |
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
Is there a reason for bSegWit and not directly use (flags.find("W") != string::pos)?
There was a problem hiding this comment.
See below. The flags are not exclusive. I need to put the flags.find() test inside the (vStrInputParts.size() == 3) so I may as well parse for both flags at the same point and store the result in variables.
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
They're not exclusive. If both flags are used, we output a P2WPKH wrapped in P2SH.
src/bitcoin-tx.cpp
Outdated
There was a problem hiding this comment.
Does this result in supporting pure P2PK (not P2PKH)?
There was a problem hiding this comment.
Yes - without either flag, the TXO will be a P2PK.
- With just the
Hflag, the TXO is a P2SH - With just the
Wflag, the TXO is a P2WPK - With both the
HandWflags, the TXO is a P2WPK wrapped in a P2SH
|
Needs rebase. |
79cd927 to
1733547
Compare
|
Rebased. @jonasschnelli - are you happy with my responses above? |
|
@jnewbery: Yes. |
|
Travis is failing on the new tests: |
f5b706d to
e5fecbf
Compare
|
I've fixed the failing testcases and squashed the commits. @jonasschnelli - please let me know if you have any further feedback for this PR. |
|
slightly tested ACK e5fecbf64d1dad360490294d1aad79497dcb1de7. |
|
utACK. |
e5fecbf to
e0d9e1f
Compare
|
rebased |
|
Travis fails with 2016-12-27 19:30:20,251 - ERROR - Output data mismatch for txcreatescript1.hex (format hex) Edit: Also make sure to include all new files: #9436 |
This commit enhances bitcoin-tx so all remaining standard TXO types can be created: - Pay to Pub Key - Multi-sig - bare multi-sig - multi-sig in Pay To Script Hash - multi-sig in Pay to Witness Script Hash - multi-sig in Pay to Witness Script Hash, wrapped in P2SH - Pay to Witness Pub Key Hash - Pay to Witness Pub Key Hash, wrapped in P2SH - Pay to Witness Script Hash - Pay to Witness Script Hash, wrapped in P2SH
This commit add testcases to test the following functions in bitcoin-tx: - add a pay to non-standard script output - add a P2SH output - add a P2WSH output - add a P2WSH wrapped in a P2SH output - add a pay to pub key output - add a P2WPKH output - add a P2WPKH wrapped in a P2SH output - add a bare multisig output - add a multisig in P2SH output - add a multisig in a P2WSH output - add a multisig in a P2WSH wrapped in as P2SH output
e0d9e1f to
b7e144b
Compare
|
Rebased. I had to do a couple of large merges (removing std namespace and updating default tx version). @laanwj - let me know if there's anything I can do to help get this merged into master. |
…dablock committed on Jan 20, 2018 Use version 2 blocks for miner_tests … @codablock codablock committed on Jan 20, 2018 Merge bitcoin#7871: Manual block file pruning. … @laanwj @codablock laanwj authored and codablock committed on Jan 11, 2017 Merge bitcoin#9507: Fix use-after-free in CTxMemPool::removeConflicts() … @sipa @codablock sipa authored and codablock committed on Jan 11, 2017 Merge bitcoin#9297: Various RPC help outputs updated … @MarcoFalke @codablock MarcoFalke authored and codablock committed on Jan 12, 2017 Merge bitcoin#9416: travis: make distdir before make … @MarcoFalke @codablock MarcoFalke authored and codablock committed on Jan 12, 2017 Merge bitcoin#9520: Deprecate non-txindex getrawtransaction and bette… … @MarcoFalke @codablock MarcoFalke authored and codablock committed on Jan 12, 2017 Merge bitcoin#9518: Return height of last block pruned by pruneblockc… … @MarcoFalke @codablock MarcoFalke authored and codablock committed on Jan 12, 2017 Merge bitcoin#9472: Disentangle progress estimation from checkpoints … … @laanwj @codablock laanwj authored and codablock committed on Jan 12, 2017 Merge bitcoin#8883: Add all standard TXO types to bitcoin-tx … @laanwj @codablock laanwj authored and codablock committed on Jan 12, 2017 Merge bitcoin#9261: Add unstored orphans with rejected parents to rec… … @laanwj @codablock laanwj authored and codablock committed on Jan 12, 2017 Merge bitcoin#9468: [Depends] Dependency updates for 0.14.0 … @laanwj @codablock laanwj authored and codablock committed on Jan 12, 2017 Merge bitcoin#9222: Add 'subtractFeeFromAmount' option to 'fundrawtra… … @laanwj @codablock laanwj authored and codablock committed on Jan 12, 2017 Merge bitcoin#9490: Replace FindLatestBefore used by importmuti with … … @sipa @codablock sipa authored and codablock committed on Jan 13, 2017 Merge bitcoin#9469: [depends] Qt 5.7.1 … @laanwj @codablock laanwj authored and codablock committed on Jan 15, 2017 Merge bitcoin#9380: Separate different uses of minimum fees … @laanwj @codablock laanwj authored and codablock committed on Jan 16, 2017 Remove SegWit related code in dash-tx @codablock codablock committed on Sep 21, 2017 Merge bitcoin#9561: Wake message handling thread when we receive a ne… … @sipa @codablock sipa authored and codablock committed on Jan 17, 2017 Merge bitcoin#9508: Remove unused Python imports … @MarcoFalke @codablock MarcoFalke authored and codablock committed on Jan 18, 2017 Merge bitcoin#9512: Fix various things -fsanitize complains about
bitcoin-tx can currently create transactions with the following TXO types:
This PR enhances bitcoin-tx so all remaining standard TXO types can be created:
The PR also includes new test cases for all tx types.