@@ -245,10 +245,11 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
245
245
for (unsigned int idx = 0 ; idx < txids.size (); idx++) {
246
246
const UniValue& txid = txids[idx];
247
247
uint256 hash (ParseHashV (txid, " txid" ));
248
- if (setTxids.count (hash))
249
- throw JSONRPCError (RPC_INVALID_PARAMETER, std::string (" Invalid parameter, duplicated txid: " )+txid.get_str ());
250
- setTxids.insert (hash);
251
- oneTxid = hash;
248
+ if (setTxids.count (hash)) {
249
+ throw JSONRPCError (RPC_INVALID_PARAMETER, std::string (" Invalid parameter, duplicated txid: " ) + txid.get_str ());
250
+ }
251
+ setTxids.insert (hash);
252
+ oneTxid = hash;
252
253
}
253
254
254
255
CBlockIndex* pblockindex = nullptr ;
@@ -281,8 +282,7 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
281
282
282
283
LOCK (cs_main);
283
284
284
- if (pblockindex == nullptr )
285
- {
285
+ if (pblockindex == nullptr ) {
286
286
CTransactionRef tx;
287
287
if (!GetTransaction (oneTxid, tx, Params ().GetConsensus (), hashBlock) || hashBlock.IsNull ())
288
288
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Transaction not yet in block" );
@@ -293,15 +293,19 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
293
293
}
294
294
295
295
CBlock block;
296
- if (!ReadBlockFromDisk (block, pblockindex, Params ().GetConsensus ()))
296
+ if (!ReadBlockFromDisk (block, pblockindex, Params ().GetConsensus ())) {
297
297
throw JSONRPCError (RPC_INTERNAL_ERROR, " Can't read block from disk" );
298
+ }
298
299
299
300
unsigned int ntxFound = 0 ;
300
- for (const auto & tx : block.vtx )
301
- if (setTxids.count (tx->GetHash ()))
301
+ for (const auto & tx : block.vtx ) {
302
+ if (setTxids.count (tx->GetHash ())) {
302
303
ntxFound++;
303
- if (ntxFound != setTxids.size ())
304
+ }
305
+ }
306
+ if (ntxFound != setTxids.size ()) {
304
307
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Not all transactions found in specified or retrieved block" );
308
+ }
305
309
306
310
CDataStream ssMB (SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
307
311
CMerkleBlock mb (block, setTxids);
0 commit comments