From 115d59c77b92953178fbd0c4005c9607284c4358 Mon Sep 17 00:00:00 2001 From: Eunovo Date: Wed, 14 Aug 2024 11:52:22 +0000 Subject: [PATCH] rpc/generatetoaddress: Reject Silent Payment addresses --- src/rpc/mining.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index d41ec5bdc6201..dc12825f606d2 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -43,6 +43,7 @@ #include #include +#include using node::BlockAssembler; using node::CBlockTemplate; @@ -285,6 +286,9 @@ static RPCHelpMan generatetoaddress() if (!IsValidDestination(destination)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address"); } + if (std::get_if(&destination)) { + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Cannot pay to Silent Payment Output in Coinbase transactions"); + } NodeContext& node = EnsureAnyNodeContext(request.context); Mining& miner = EnsureMining(node);