Merge #9211: [0.12 branch] Backports
d609895
[Wallet] Bugfix: FRT: don't terminate when keypool is empty (Jonas Schnelli)8dee97f
[QA] add fundrawtransaction test on a locked wallet with empty keypool (Jonas Schnelli)82e29e8
torcontrol: Explicitly request RSA1024 private key (Wladimir J. van der Laan)cca151b
Send tip change notification from invalidateblock (Russell Yanofsky)ad99a79
[rpcwallet] Don't use floating point (MarcoFalke)
This commit is contained in:
commit
c1b7421781
|
@ -457,6 +457,23 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
self.is_network_split=False
|
self.is_network_split=False
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
|
# drain the keypool
|
||||||
|
self.nodes[1].getnewaddress()
|
||||||
|
inputs = []
|
||||||
|
outputs = {self.nodes[0].getnewaddress():1.1}
|
||||||
|
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||||
|
# fund a transaction that requires a new key for the change output
|
||||||
|
# creating the key must be impossible because the wallet is locked
|
||||||
|
try:
|
||||||
|
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
|
||||||
|
raise AssertionError("Wallet unlocked without passphrase")
|
||||||
|
except JSONRPCException as e:
|
||||||
|
assert('Keypool ran out' in e.error['message'])
|
||||||
|
|
||||||
|
#refill the keypool
|
||||||
|
self.nodes[1].walletpassphrase("test", 100)
|
||||||
|
self.nodes[1].walletlock()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
|
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
|
||||||
raise AssertionError("Wallet unlocked without passphrase")
|
raise AssertionError("Wallet unlocked without passphrase")
|
||||||
|
|
|
@ -2999,6 +2999,7 @@ bool InvalidateBlock(CValidationState& state, const Consensus::Params& consensus
|
||||||
|
|
||||||
InvalidChainFound(pindex);
|
InvalidChainFound(pindex);
|
||||||
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS);
|
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS);
|
||||||
|
uiInterface.NotifyBlockTip(IsInitialBlockDownload(), pindex->pprev);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r
|
||||||
|
|
||||||
// Finally - now create the service
|
// Finally - now create the service
|
||||||
if (private_key.empty()) // No private key, generate one
|
if (private_key.empty()) // No private key, generate one
|
||||||
private_key = "NEW:BEST";
|
private_key = "NEW:RSA1024"; // Explicitly request RSA1024 - see issue #9214
|
||||||
// Request hidden service, redirect port.
|
// Request hidden service, redirect port.
|
||||||
// Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient
|
// Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient
|
||||||
// choice. TODO; refactor the shutdown sequence some day.
|
// choice. TODO; refactor the shutdown sequence some day.
|
||||||
|
|
|
@ -595,8 +595,8 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp)
|
||||||
if (!address.IsValid())
|
if (!address.IsValid())
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||||
CScript scriptPubKey = GetScriptForDestination(address.Get());
|
CScript scriptPubKey = GetScriptForDestination(address.Get());
|
||||||
if (!IsMine(*pwalletMain,scriptPubKey))
|
if (!IsMine(*pwalletMain, scriptPubKey))
|
||||||
return (double)0.0;
|
return ValueFromAmount(0);
|
||||||
|
|
||||||
// Minimum confirmations
|
// Minimum confirmations
|
||||||
int nMinDepth = 1;
|
int nMinDepth = 1;
|
||||||
|
@ -674,7 +674,7 @@ UniValue getreceivedbyaccount(const UniValue& params, bool fHelp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (double)nAmount / (double)COIN;
|
return ValueFromAmount(nAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2104,7 +2104,11 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||||
CPubKey vchPubKey;
|
CPubKey vchPubKey;
|
||||||
bool ret;
|
bool ret;
|
||||||
ret = reservekey.GetReservedKey(vchPubKey);
|
ret = reservekey.GetReservedKey(vchPubKey);
|
||||||
assert(ret); // should never fail, as we just unlocked
|
if (!ret)
|
||||||
|
{
|
||||||
|
strFailReason = _("Keypool ran out, please call keypoolrefill first");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
scriptChange = GetScriptForDestination(vchPubKey.GetID());
|
scriptChange = GetScriptForDestination(vchPubKey.GetID());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue