[0.17] Mandatory coinbase feature#430
[0.17] Mandatory coinbase feature#430instagibbs merged 2 commits intoElementsProject:elements-0.17from
Conversation
9897b5e to
5d77f54
Compare
a5536b4 to
22396a7
Compare
src/init.cpp
Outdated
| gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", false, OptionsCategory::RPC); | ||
| gArgs.AddArg("-rpcworkqueue=<n>", strprintf("Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), true, OptionsCategory::RPC); | ||
| gArgs.AddArg("-server", "Accept command line and JSON-RPC commands", false, OptionsCategory::RPC); | ||
| gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::RPC); |
There was a problem hiding this comment.
should be OptionsCategory::CHAINPARAMS.
There was a problem hiding this comment.
Agreed, and it should be in chainparamsbase.cpp
src/chainparams.cpp
Outdated
| assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); | ||
|
|
||
| // All non-zero coinbase outputs must go to this scriptPubKey | ||
| consensus.mandatory_coinbase_destination = StrHexToScriptWithDefault(gArgs.GetArg("-con_mandatorycoinbase", ""), CScript()); // Blank script allows any coinbase destination |
There was a problem hiding this comment.
Why not just
| consensus.mandatory_coinbase_destination = StrHexToScriptWithDefault(gArgs.GetArg("-con_mandatorycoinbase", ""), CScript()); // Blank script allows any coinbase destination | |
| // Blank script allows any coinbase destination | |
| consensus.mandatory_coinbase_destination = ParseHex(args.GetArg("-con_mandatorycoinbase", "")); |
There was a problem hiding this comment.
Does it implicitly convert it? It's a script, not a series of bytes.
There was a problem hiding this comment.
It seems to be working on f0391db#diff-64cbe1ad5465e13bc59ee8bb6f3de2e7R431
There was a problem hiding this comment.
Hm ok in that case we don't need StrHexToScriptWithDefault at all, though I'll make the conversion explicit.
There was a problem hiding this comment.
Oh right C++: It can implicitly use constructor.
| #include <map> | ||
| #include <string> | ||
|
|
||
| #include <script/script.h> // mandatory_coinbase_destination |
There was a problem hiding this comment.
Isn't this dependency giving you problems? I would swear I tried the same with #433
There was a problem hiding this comment.
hopefully not, we do the same thing for elements-0.14.1 IIRC!
22396a7 to
0d52731
Compare
|
Hmm, the test doesn't seem to be working here: |
|
hmm it appears my refactoring broke something. |
|
oh, I only applied the argument to regtest, tip is using "regtest2" custom chain. We should be removing regtest at some point, right @jtimon ? I'll move it to custom chain params now. |
0d52731 to
29f601e
Compare
|
Turns out me being explicit with construction means I was doing it the wrong way, the implicit way automagically was correct. |
29f601e to
0d20b55
Compare
tACK 0d20b55 |
| nBlocksTotal++; | ||
|
|
||
| // Check that all non-zero coinbase outputs pay to the required destination | ||
| const CScript& mandatory_coinbase_destination = chainparams.GetConsensus().mandatory_coinbase_destination; |
There was a problem hiding this comment.
Is this local variable worth it? small nit, feel free to ignore.
|
We can remove regtest, testnet and main when we can no longer support them for real, I guess. Didn't look with much attention to the test, but the code looks good. utACK 0d20b55 |
0d20b55 add mandatory coinbase functional test (Gregory Sanders) edb0532 add consensus.mandatory_coinbase_destination (Gregory Sanders) Pull request description: Includes functional test Tree-SHA512: e7fdf4584c5a61516778dff272c0f4c9964fee515b705c4fd3ade842954bcc7426bdaf5273a64e4b2472fedc940ead7552c0ec80b4608aac381f91a8f2356d95
|
sigh, I didn't add the test to the test list... will fix |
Includes functional test