mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
* importmulti: Don't add internal addresses to address book * Update test/functional/wallet_importmulti.py Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * Update test/functional/wallet_importmulti.py Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * Updated rpcdump * Update test/functional/wallet_importmulti.py * fix whitespace in rpcdump.cpp to be inline with upstream Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
f8ecee7e6f
commit
12218473f8
@ -1283,8 +1283,9 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");
|
||||
}
|
||||
|
||||
// add to address book or update label
|
||||
if (IsValidDestination(dest)) {
|
||||
// if not internal add to address book or update label
|
||||
if (!internal) {
|
||||
assert(IsValidDestination(dest));
|
||||
pwallet->SetAddressBook(dest, label, "receive");
|
||||
}
|
||||
|
||||
@ -1349,7 +1350,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
||||
" \"redeemscript\": \"<script>\" , (string, optional) Allowed only if the scriptPubKey is a P2SH address or a P2SH scriptPubKey\n"
|
||||
" \"pubkeys\": [\"<pubKey>\", ... ] , (array, optional) Array of strings giving pubkeys that must occur in the output or redeemscript\n"
|
||||
" \"keys\": [\"<key>\", ... ] , (array, optional) Array of strings giving private keys whose corresponding public keys must occur in the output or redeemscript\n"
|
||||
" \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be treated as not incoming payments\n"
|
||||
" \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be treated as not incoming payments aka change\n"
|
||||
" \"watchonly\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be considered watched even when they're not spendable, only allowed if keys are empty\n"
|
||||
" \"label\": <label> , (string, optional, default: '') Label to assign to the address (aka account name, for now), only allowed with internal=false\n"
|
||||
" }\n"
|
||||
|
@ -43,7 +43,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
|
||||
# RPC importmulti -----------------------------------------------
|
||||
|
||||
# Bitcoin Address
|
||||
# Bitcoin Address (implicit non-internal)
|
||||
self.log.info("Should import an address")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
@ -57,6 +57,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
assert_equal(address_assert['ischange'], False)
|
||||
watchonly_address = address['address']
|
||||
watchonly_timestamp = timestamp
|
||||
|
||||
@ -84,6 +85,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
assert_equal(address_assert['ischange'], True)
|
||||
|
||||
# Nonstandard scriptPubKey + !internal
|
||||
self.log.info("Should not import a nonstandard scriptPubKey without internal flag")
|
||||
@ -102,7 +104,7 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# Address + Public key + !Internal
|
||||
# Address + Public key + !Internal(explicit)
|
||||
self.log.info("Should import an address with public key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
@ -110,7 +112,8 @@ class ImportMultiTest(BitcoinTestFramework):
|
||||
"address": address['address']
|
||||
},
|
||||
"timestamp": "now",
|
||||
"pubkeys": [ address['pubkey'] ]
|
||||
"pubkeys": [ address['pubkey'] ],
|
||||
"internal": False
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
|
Loading…
Reference in New Issue
Block a user