Fix createrawtransaction multi op return - issue #14868 #14888
pull isghe wants to merge 5 commits into bitcoin:master from isghe:fix-createrawtransaction-multi-OP_RETURN changing 1 files +14 −10-
isghe commented at 6:22 PM on December 6, 2018: contributor
-
e53af5a6c9
fix-createrawtransaction issue 14868
``` $ ./src/bitcoin-cli createrawtransaction "[]" "{\"data\":\"ee\", \"data\":\"ff\"}" 0200000000020000000000000000036a01ee0000000000000000036a01ff00000000 ``` ``` $ ./src/bitcoin-cli createrawtransaction "[]" "[{\"data\":\"ee\"}, {\"data\":\"ff\"}]" 0200000000020000000000000000036a01ee0000000000000000036a01ff00000000 ``` https://github.com/bitcoin/bitcoin/issues/14868 -
fix-createrawtransaction: const 1105ae8899
-
fix-createrawtransaction: shared valStr 2fd66aa5a5
-
fix-createrawtransaction:moved getKeys out of loop f80915c2c2
-
fix-createrawtransaction: rename 'name_' to 'name' 8c65693c21
-
gmaxwell commented at 7:07 PM on December 6, 2018: contributor
NAK. Network IsStandard rules prohibit multiple op_returns (https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp#L135), additional bloat on the blockchain is also not desired. The inputs to this RPC are also an array, so duplicating inputs is also pretty broken.
- fanquake added the label RPC/REST/ZMQ on Dec 6, 2018
-
Empact commented at 9:08 PM on December 6, 2018: member
@isghe you can help review by making your PR minimal:
Patchsets should always be focused. For example, a pull request could add a feature, fix a bug, or refactor code; but not a mixture. https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#pull-request-philosophy
-
DrahtBot commented at 9:34 PM on December 6, 2018: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #14890 (rpc: Avoid creating non-standard raw transactions by MarcoFalke)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
- isghe referenced this in commit 5987b7cadd on Dec 6, 2018
-
isghe commented at 11:08 PM on December 6, 2018: contributor
https://github.com/isghe/bitcoin/commits/raise-error-createrawtransaction-multi-OP_RETURN just adding on this PR
const CTransaction rawTxCopy (rawTx); std::string error; if (!IsStandardTx (rawTxCopy, error)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: " + error); }obtaining:
$ ./src/bitcoin-cli createrawtransaction "[]" "[{\"mguLQ6eGCHpnmRrDwAjbPpYAHjxY6GneeQ\":\"0.1\"}, {\"data\":\"ee\"}, {\"muLYgM1L3gCzLs1bPX5cVzx3ax1f4vBcpN\":\"0.2\"},{\"data\":\"ff\"}]" | xargs ./src/bitcoin-cli decoderawtransaction error code: -8 error message: Invalid parameter combination: multi-op-return -
Empact commented at 11:23 PM on December 6, 2018: member
5987b7cadd15cd1b524fec430868ee0c174f06da makes sense to me, independent of this issue. Calls for another PR IMO.
-
isghe commented at 11:42 PM on December 6, 2018: contributor
@Empact my idea, is that
createrawtransactionshould check if a transaction is standard or not, just delegating toIsStandardTxfunction. If not, we are spreading the rules in the source code, and doesn't sound good. At this point I think it would be better to create a PR removing hard-coded rules written increaterawtransaction, delegating the all things toIsStandardTx. I'll work on it, in the weekend. -
isghe commented at 1:38 AM on December 7, 2018: contributor
anyway,
createrawtransactioncould be created as an external tool, without affecting the consensus rules -
gmaxwell commented at 9:26 AM on December 7, 2018: contributor
Rejecting duplicate data fields instead of mangling them is the right thing to do regardless of standardness rules: as I pointed out, the input is a dictionary... and also even if standardness permitted multiple op_returns we probably would not support it.
IsStandard probably shouldn't be run on non-final/signed transactions so it isn't a solution here. (It might actually work, but if so that's largely an accident.) The standardness behaviour of the wallet and the network are disjoint in any case: lets imagine that the network standardness rule changed, we still wouldn't want the wallet creating things the old behaviour would reject until the new behaviour were widely deployed. Sometimes code/behavior that looks the same isn't really the same and isn't a duplicate due to how the code needs to be maintained or modified.
-
promag commented at 9:48 AM on December 7, 2018: member
NACK, this changes nothing.
- DrahtBot added the label Needs rebase on Dec 7, 2018
-
DrahtBot commented at 4:45 PM on December 7, 2018: member
<!--cf906140f33d8803c4a75a2196329ecb-->Needs rebase
- jnewbery closed this on Dec 7, 2018
- laanwj removed the label Needs rebase on Oct 24, 2019
- DrahtBot locked this on Dec 16, 2021