Auto merge of #4794 - LarryRuane:allow-getaddressutxos, r=daira
allow getaddressutxos if -lightwalletd The wallets need to be able to retrieve, via lightwalletd, the UTXO set for a given address, see https://github.com/zcash/lightwalletd/issues/312. The `getaddressutxos` rpc that was added for Insight Explorer is perfect for this, but this rpc is disabled when only `-lightwalletd` is enabled (that is, it requires `-insightexplorer`, which is a superset of `-lightwalletd`). However, the `DB_ADDRESSUNSPENTINDEX` index that supports this rpc is present when only `-lightwalletd` is enabled. This was probably a (fortuitous, as it turns out) oversight. So all that's required is to allow this rpc when `-lightwalletd` is enabled.
This commit is contained in:
commit
8fa19fd50d
|
@ -10,7 +10,7 @@
|
||||||
# getaddresstxids
|
# getaddresstxids
|
||||||
# getaddressbalance
|
# getaddressbalance
|
||||||
# getaddressdeltas
|
# getaddressdeltas
|
||||||
# getaddressutxos - available only for insightexplorer
|
# getaddressutxos
|
||||||
# getaddressmempool
|
# getaddressmempool
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ class AddressIndexTest(BitcoinTestFramework):
|
||||||
assert_equal(deltas_info['end']['hash'], block_hash)
|
assert_equal(deltas_info['end']['hash'], block_hash)
|
||||||
|
|
||||||
# Test getaddressutxos by comparing results with deltas
|
# Test getaddressutxos by comparing results with deltas
|
||||||
utxos = self.nodes[1].getaddressutxos(addr1)
|
utxos = self.nodes[3].getaddressutxos(addr1)
|
||||||
|
|
||||||
# The value 4 note was spent, so won't show up in the utxo list,
|
# The value 4 note was spent, so won't show up in the utxo list,
|
||||||
# so for comparison, remove the 4 (and -4 for output) from the
|
# so for comparison, remove the 4 (and -4 for output) from the
|
||||||
|
|
|
@ -668,8 +668,8 @@ UniValue getaddressmempool(const UniValue& params, bool fHelp)
|
||||||
UniValue getaddressutxos(const UniValue& params, bool fHelp)
|
UniValue getaddressutxos(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
std::string disabledMsg = "";
|
std::string disabledMsg = "";
|
||||||
if (!fExperimentalInsightExplorer) {
|
if (!(fExperimentalInsightExplorer || fExperimentalLightWalletd)) {
|
||||||
disabledMsg = experimentalDisabledHelpMsg("getaddressutxos", {"insightexplorer"});
|
disabledMsg = experimentalDisabledHelpMsg("getaddressutxos", {"insightexplorer", "lightwalletd"});
|
||||||
}
|
}
|
||||||
if (fHelp || params.size() != 1)
|
if (fHelp || params.size() != 1)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
|
@ -719,7 +719,7 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
|
||||||
+ HelpExampleRpc("getaddressutxos", "{\"addresses\": [\"tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ\"], \"chainInfo\": true}")
|
+ HelpExampleRpc("getaddressutxos", "{\"addresses\": [\"tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ\"], \"chainInfo\": true}")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!fExperimentalInsightExplorer) {
|
if (!(fExperimentalInsightExplorer || fExperimentalLightWalletd)) {
|
||||||
throw JSONRPCError(RPC_MISC_ERROR, "Error: getaddressutxos is disabled. "
|
throw JSONRPCError(RPC_MISC_ERROR, "Error: getaddressutxos is disabled. "
|
||||||
"Run './zcash-cli help getaddressutxos' for instructions on how to enable this feature.");
|
"Run './zcash-cli help getaddressutxos' for instructions on how to enable this feature.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue