mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 03:33:27 -03:00
Use stop/[start,stop] notation in importmulti desc range
This commit is contained in:
parent
4566011631
commit
1675b7ce55
2 changed files with 7 additions and 15 deletions
|
@ -1132,13 +1132,10 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID
|
||||||
if (!data.exists("range")) {
|
if (!data.exists("range")) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor is ranged, please specify the range");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Descriptor is ranged, please specify the range");
|
||||||
}
|
}
|
||||||
const UniValue& range = data["range"];
|
auto range = ParseRange(data["range"]);
|
||||||
range_start = range.exists("start") ? range["start"].get_int64() : 0;
|
range_start = range.first;
|
||||||
if (!range.exists("end")) {
|
range_end = range.second;
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "End of range for descriptor must be specified");
|
if (range_start < 0 || (range_end >> 31) != 0 || range_end - range_start >= 1000000) {
|
||||||
}
|
|
||||||
range_end = range["end"].get_int64();
|
|
||||||
if (range_end < range_start || range_start < 0) {
|
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid descriptor range specified");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid descriptor range specified");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1373,12 +1370,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||||
{"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
|
{"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"range", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the start and end of the range to import",
|
{"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the end or the range (in the form [begin,end]) to import"},
|
||||||
{
|
|
||||||
{"start", RPCArg::Type::NUM, /* default */ "0", "Start of the range to import"},
|
|
||||||
{"end", RPCArg::Type::NUM, RPCArg::Optional::NO, "End of the range to import (inclusive)"},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{"internal", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be treated as not incoming payments (also known as change)"},
|
{"internal", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be treated as not incoming payments (also known as change)"},
|
||||||
{"watchonly", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be considered watchonly."},
|
{"watchonly", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be considered watchonly."},
|
||||||
{"label", RPCArg::Type::STR, /* default */ "''", "Label to assign to the address, only allowed with internal=false"},
|
{"label", RPCArg::Type::STR, /* default */ "''", "Label to assign to the address, only allowed with internal=false"},
|
||||||
|
|
|
@ -584,7 +584,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||||
self.log.info("Should import the ranged descriptor with specified range as solvable")
|
self.log.info("Should import the ranged descriptor with specified range as solvable")
|
||||||
self.test_importmulti({"desc": descsum_create(desc),
|
self.test_importmulti({"desc": descsum_create(desc),
|
||||||
"timestamp": "now",
|
"timestamp": "now",
|
||||||
"range": {"end": 1}},
|
"range": 1},
|
||||||
success=True,
|
success=True,
|
||||||
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."])
|
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."])
|
||||||
for address in addresses:
|
for address in addresses:
|
||||||
|
@ -807,7 +807,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||||
'desc': descsum_create('wpkh([80002067/0h/0h]' + xpub + '/*)'),
|
'desc': descsum_create('wpkh([80002067/0h/0h]' + xpub + '/*)'),
|
||||||
'keypool': True,
|
'keypool': True,
|
||||||
'timestamp': 'now',
|
'timestamp': 'now',
|
||||||
'range' : {'start': 0, 'end': 4}
|
'range' : [0, 4],
|
||||||
}]
|
}]
|
||||||
)
|
)
|
||||||
for i in range(0, 5):
|
for i in range(0, 5):
|
||||||
|
|
Loading…
Add table
Reference in a new issue