diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-07 17:36:46 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-07 17:37:32 +0100 |
commit | 3e500241200282eb475709e9e85c54ebcc92eaf5 (patch) | |
tree | 1b90767226efbd97bed63845398fdbdb94db494f /src | |
parent | 7630a1fe9a4c9a38b47fe385afb8d8a1902870d6 (diff) | |
parent | fa4c16d2e72a8ec1032da49a68c9913c2595dbfe (diff) |
Merge #11838: qa: Add getrawtransaction in_active_chain=False test
fa4c16d qa: Add getrawtransaction in_active_chain=False test (MarcoFalke)
Pull request description:
#10275 accidentally forgot to add a test for `in_active_chain==False`.
This adds a test and also removes the special casing of `blockhash.IsNull()`, which makes no sense imo.
Tree-SHA512: 6c51295820b3dcd53b0b48020ab2b8c8f5864cd5061ddab2b35d35d643eb3e60ef95ff20c06c985a2e47f7080e82f27f3e00ee61c85dce627776d5ea6febee8f
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/rawtransaction.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index b26f10e476..018c255325 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -155,14 +155,12 @@ UniValue getrawtransaction(const JSONRPCRequest& request) if (!request.params[2].isNull()) { uint256 blockhash = ParseHashV(request.params[2], "parameter 3"); - if (!blockhash.IsNull()) { - BlockMap::iterator it = mapBlockIndex.find(blockhash); - if (it == mapBlockIndex.end()) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block hash not found"); - } - blockindex = it->second; - in_active_chain = chainActive.Contains(blockindex); + BlockMap::iterator it = mapBlockIndex.find(blockhash); + if (it == mapBlockIndex.end()) { + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block hash not found"); } + blockindex = it->second; + in_active_chain = chainActive.Contains(blockindex); } CTransactionRef tx; |