mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
Merge #9295: [Wallet] Bugfix: Fundrawtransaction: don't terminate when keypool is empty
1a6eacb [QA] add fundrawtransaction test on a locked wallet with empty keypool (Jonas Schnelli) c24a4f5 [Wallet] Bugfix: FRT: don't terminate when keypool is empty (Jonas Schnelli)
This commit is contained in:
commit
815640ec6a
@ -484,6 +484,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")
|
||||||
|
@ -2389,7 +2389,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…
x
Reference in New Issue
Block a user