Skip to content

Commit 665085f

Browse files
committed
rpc/generatetoaddress: Reject Silent Payment addresses
1 parent e58ff43 commit 665085f

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
@@ -43,6 +43,7 @@
4343

4444
#include <memory>
4545
#include <stdint.h>
46+
#include <variant>
4647

4748
using node::BlockAssembler;
4849
using node::CBlockTemplate;
@@ -285,6 +286,9 @@ static RPCHelpMan generatetoaddress()
285286
if (!IsValidDestination(destination)) {
286287
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
287288
}
289+
if (std::get_if<V0SilentPaymentDestination>(&destination)) {
290+
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Cannot pay to Silent Payment Output in Coinbase transactions");
291+
}
288292

289293
NodeContext& node = EnsureAnyNodeContext(request.context);
290294
Mining& miner = EnsureMining(node);

0 commit comments

Comments
 (0)