Browse Source

[wallet] rpc: Drop misleading option

Github-Pull: #8581
Rebased-From: fab5ecb771
0.13
MarcoFalke 8 years ago
parent
commit
526d2b0472
  1. 10
      doc/release-notes.md
  2. 31
      qa/rpc-tests/importprunedfunds.py
  3. 6
      src/wallet/rpcdump.cpp

10
doc/release-notes.md

@ -41,7 +41,15 @@ Notable changes
Example item Example item
-------------- --------------
0.13.0 Change log Low-level RPC changes
---------------------
- `importprunedfunds` only accepts two required arguments. Some versions accept
an optional third arg, which was always ignored. Make sure to never pass more
than two arguments.
0.13.1 Change log
================= =================
Detailed release notes follow. This overview includes changes that affect Detailed release notes follow. This overview includes changes that affect

31
qa/rpc-tests/importprunedfunds.py

@ -21,13 +21,9 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
self.sync_all() self.sync_all()
def run_test(self): def run_test(self):
import time
begintime = int(time.time())
print("Mining blocks...") print("Mining blocks...")
self.nodes[0].generate(101) self.nodes[0].generate(101)
# sync
self.sync_all() self.sync_all()
# address # address
@ -72,7 +68,6 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex'] rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex']
proof2 = self.nodes[0].gettxoutproof([txnid2]) proof2 = self.nodes[0].gettxoutproof([txnid2])
txnid3 = self.nodes[0].sendtoaddress(address3, 0.025) txnid3 = self.nodes[0].sendtoaddress(address3, 0.025)
self.nodes[0].generate(1) self.nodes[0].generate(1)
rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex'] rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex']
@ -82,28 +77,27 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
#Import with no affiliated address #Import with no affiliated address
try: try:
result1 = self.nodes[1].importprunedfunds(rawtxn1, proof1, "") self.nodes[1].importprunedfunds(rawtxn1, proof1)
except JSONRPCException as e: except JSONRPCException as e:
assert('No addresses' in e.error['message']) assert('No addresses' in e.error['message'])
else: else:
assert(False) assert(False)
balance1 = self.nodes[1].getbalance("", 0, True) balance1 = self.nodes[1].getbalance("", 0, True)
assert_equal(balance1, Decimal(0)) assert_equal(balance1, Decimal(0))
#Import with affiliated address with no rescan #Import with affiliated address with no rescan
self.nodes[1].importaddress(address2, "", False) self.nodes[1].importaddress(address2, "add2", False)
result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2, "") result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2)
balance2 = Decimal(self.nodes[1].getbalance("", 0, True)) balance2 = self.nodes[1].getbalance("add2", 0, True)
assert_equal(balance2, Decimal('0.05')) assert_equal(balance2, Decimal('0.05'))
#Import with private key with no rescan #Import with private key with no rescan
self.nodes[1].importprivkey(address3_privkey, "", False) self.nodes[1].importprivkey(address3_privkey, "add3", False)
result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3, "") result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3)
balance3 = Decimal(self.nodes[1].getbalance("", 0, False)) balance3 = self.nodes[1].getbalance("add3", 0, False)
assert_equal(balance3, Decimal('0.025')) assert_equal(balance3, Decimal('0.025'))
balance3 = Decimal(self.nodes[1].getbalance("", 0, True)) balance3 = self.nodes[1].getbalance("*", 0, True)
assert_equal(balance3, Decimal('0.075')) assert_equal(balance3, Decimal('0.075'))
#Addresses Test - after import #Addresses Test - after import
@ -118,7 +112,6 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
assert_equal(address_info['ismine'], True) assert_equal(address_info['ismine'], True)
#Remove transactions #Remove transactions
try: try:
self.nodes[1].removeprunedfunds(txnid1) self.nodes[1].removeprunedfunds(txnid1)
except JSONRPCException as e: except JSONRPCException as e:
@ -126,17 +119,15 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
else: else:
assert(False) assert(False)
balance1 = self.nodes[1].getbalance("*", 0, True)
balance1 = Decimal(self.nodes[1].getbalance("", 0, True))
assert_equal(balance1, Decimal('0.075')) assert_equal(balance1, Decimal('0.075'))
self.nodes[1].removeprunedfunds(txnid2) self.nodes[1].removeprunedfunds(txnid2)
balance2 = Decimal(self.nodes[1].getbalance("", 0, True)) balance2 = self.nodes[1].getbalance("*", 0, True)
assert_equal(balance2, Decimal('0.025')) assert_equal(balance2, Decimal('0.025'))
self.nodes[1].removeprunedfunds(txnid3) self.nodes[1].removeprunedfunds(txnid3)
balance3 = Decimal(self.nodes[1].getbalance("", 0, True)) balance3 = self.nodes[1].getbalance("*", 0, True)
assert_equal(balance3, Decimal('0.0')) assert_equal(balance3, Decimal('0.0'))
if __name__ == '__main__': if __name__ == '__main__':

6
src/wallet/rpcdump.cpp

@ -257,6 +257,7 @@ UniValue importprunedfunds(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp)) if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue; return NullUniValue;
// 0.13.x: Silently accept up to 3 params, but ignore the third:
if (fHelp || params.size() < 2 || params.size() > 3) if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error( throw runtime_error(
"importprunedfunds\n" "importprunedfunds\n"
@ -264,7 +265,6 @@ UniValue importprunedfunds(const UniValue& params, bool fHelp)
"\nArguments:\n" "\nArguments:\n"
"1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n" "1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n"
"2. \"txoutproof\" (string, required) The hex output from gettxoutproof that contains the transaction\n" "2. \"txoutproof\" (string, required) The hex output from gettxoutproof that contains the transaction\n"
"3. \"label\" (string, optional) An optional label\n"
); );
CTransaction tx; CTransaction tx;
@ -277,10 +277,6 @@ UniValue importprunedfunds(const UniValue& params, bool fHelp)
CMerkleBlock merkleBlock; CMerkleBlock merkleBlock;
ssMB >> merkleBlock; ssMB >> merkleBlock;
string strLabel = "";
if (params.size() == 3)
strLabel = params[2].get_str();
//Search partial merkle tree in proof for our transaction and index in valid block //Search partial merkle tree in proof for our transaction and index in valid block
vector<uint256> vMatch; vector<uint256> vMatch;
vector<unsigned int> vIndex; vector<unsigned int> vIndex;

Loading…
Cancel
Save