Skip to content

Commit bd4ae1b

Browse files
committed
rpc: fix crash in getcompactsketch
This originates in 8723deb which has no PR associated with it. We've really gotta stop putting thousands of unreviewed commits into this project and rebasing the history away..
1 parent f5ed4e4 commit bd4ae1b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rpc/mining.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,10 @@ static RPCHelpMan getcompactsketch()
15271527
CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION);
15281528
ssBlock >> block;
15291529

1530+
if (block.vtx.empty()) {
1531+
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Cannot obtain sketch of empty block.");
1532+
}
1533+
15301534
CBlockHeaderAndShortTxIDs cmpctblock(block, true);
15311535

15321536
CDataStream ssCompactBlock(SER_NETWORK, PROTOCOL_VERSION);

0 commit comments

Comments
 (0)