refactor: Move GetDifficulty out of rpc/server.h#10095
refactor: Move GetDifficulty out of rpc/server.h#10095laanwj merged 3 commits intobitcoin:masterfrom
rpc/server.h#10095Conversation
It has no business in `rpcserver.h`. Define it in the interface header
of the implementation unit `rpcblockchain` where it is defined.
Also modernize the signature to:
double GetDifficulty(const CBlockIndex* blockindex = nullptr);
(remove `extern`, replace `NULL` with `nullptr`)
|
Tested ACK e6dcfee Can |
|
utACK e6dcfee |
|
@jnewbery Done |
|
I see rest.cpp also uses a few functions from this file: Going to add them to the header as well. |
de4b7ac to
c7e9aa7
Compare
|
Looks good to me. Tested ACK c7e9aa7c1a92adba141958e5f86d267f34cc9508 |
|
ScriptPubKeyToJSON and TxToJSON are defined in https://github.com/bitcoin/bitcoin/blob/master/src/rpc/rawtransaction.cpp#L37 not rpc/blockchain.cpp. Either move the declaration or the definition for both to be in the same .h and .cpp utACK c7e9aa7c1a92adba141958e5f86d267f34cc9508 modulo nit. |
|
@jtimon Good catch. I'll move them to their own header. |
|
Or just refactor them out entirely since they're duplicate code: #8824 |
|
Yes makes sense I'll just remove them from the header and ignore them for
this PR.
…On Mar 28, 2017 7:32 PM, "John Newbery" ***@***.***> wrote:
Or just refactor them out entirely since they're duplicate code: #8824
<#8824>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#10095 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHutvB4r9J2Zyy0H9ZM1oTxiQvWUJbEks5rqUQogaJpZM4MqMwJ>
.
|
c7e9aa7 to
f885b67
Compare
|
Done, now those two lines remain in |
f885b67 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit (Wladimir J. van der Laan) 8d8f28d refactor: Move RPCNotifyBlockChange out of `rpc/server.h` (Wladimir J. van der Laan) e6dcfee refactor: Move GetDifficulty out of `rpc/server.h` (Wladimir J. van der Laan) Tree-SHA512: fc2656611d18442f2fddba5ac1554d958151f6785c2039afdfc36735d7e71592d9686ff6cc7b2ad95180071d7514470e62c52d697c5a1e88f851bddaf5942edb
f885b67 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit (Wladimir J. van der Laan) 8d8f28d refactor: Move RPCNotifyBlockChange out of `rpc/server.h` (Wladimir J. van der Laan) e6dcfee refactor: Move GetDifficulty out of `rpc/server.h` (Wladimir J. van der Laan) Tree-SHA512: fc2656611d18442f2fddba5ac1554d958151f6785c2039afdfc36735d7e71592d9686ff6cc7b2ad95180071d7514470e62c52d697c5a1e88f851bddaf5942edb
GetDifficultyhas no business inrpcserver.h. Define it in the interface header of the implementation unitrpcblockchainwhere it is defined.Also modernize the signature to:
(remove
extern, replaceNULLwithnullptr)