Merge 2795e89cc5 into merged_master (Bitcoin PR bitcoin/bitcoin#28998)

This commit is contained in:
ivanlele 2026-02-16 17:03:56 +00:00
commit f3ab17230b
No known key found for this signature in database
2 changed files with 50 additions and 20 deletions

View file

@ -951,7 +951,7 @@ static RPCHelpMan getnodeaddresses()
static RPCHelpMan addpeeraddress()
{
return RPCHelpMan{"addpeeraddress",
"\nAdd the address of a potential peer to the address manager. This RPC is for testing only.\n",
"Add the address of a potential peer to an address manager table. This RPC is for testing only.",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The IP address of the peer"},
{"port", RPCArg::Type::NUM, RPCArg::Optional::NO, "The port of the peer"},
@ -960,7 +960,8 @@ static RPCHelpMan addpeeraddress()
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::BOOL, "success", "whether the peer address was successfully added to the address manager"},
{RPCResult::Type::BOOL, "success", "whether the peer address was successfully added to the address manager table"},
{RPCResult::Type::STR, "error", /*optional=*/true, "error description, if the address could not be added"},
},
},
RPCExamples{
@ -989,8 +990,13 @@ static RPCHelpMan addpeeraddress()
success = true;
if (tried) {
// Attempt to move the address to the tried addresses table.
addrman.Good(address);
if (!addrman.Good(address)) {
success = false;
obj.pushKV("error", "failed-adding-to-tried");
}
}
} else {
obj.pushKV("error", "failed-adding-to-new");
}
}