Skip to content
Permalink
Browse files

RPC/Wallet: Add "use_txids" to output of getaddressinfo

  • Loading branch information
luke-jr committed May 5, 2019
1 parent 545af21 commit c05d6a801d797dae722892e0c2e90db9b00bdc19
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/wallet/rpcwallet.cpp
@@ -3689,6 +3689,10 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
" \"name\": \"labelname\" (string) The label\n"
" \"purpose\": \"string\" (string) Purpose of address (\"send\" for sending address, \"receive\" for receiving address)\n"
" },...\n"
" ],\n"
" \"use_txids\": [\n"
" \"txid\", (string) The ids of transactions involving this wallet which received with the address\n"
" ...\n"
" ]\n"
"}\n"
},
@@ -3761,6 +3765,15 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
}
ret.pushKV("labels", std::move(labels));

// NOTE: Intentionally not special-casing a single txid: while addresses
// should never be reused, it's not unexpected to have RBF result in
// multiple txids for a single use.
UniValue use_txids(UniValue::VARR);
pwallet->FindScriptPubKeyUsed(std::set<CScript>{scriptPubKey}, [&use_txids](const CWalletTx& wtx){
use_txids.push_back(wtx.tx->GetHash().GetHex());
});
ret.pushKV("use_txids", std::move(use_txids));

return ret;
}

0 comments on commit c05d6a8

Please sign in to comment.
You can’t perform that action at this time.