Merge bitcoin/bitcoin#26723: test: call keypoolrefill with priv key disabled should throw an error

ec63a4892e test: call `keypoolrefill` with private keys disabled should throw an error (brunoerg)

Pull request description:

  This PR adds test coverage for the following error:
  cb32328d1b/src/wallet/rpc/addresses.cpp (L332-L334)

ACKs for top commit:
  aureleoules:
    ACK ec63a4892e

Tree-SHA512: b5deda8981ff472f290e6e16c8723a58e02cbe099afd1f672c099f4add0a1d9b192b11a2c3f0e11b96794671f6b9efa75812b7a174248d7c58d7fd7d3310e7b9
This commit is contained in:
MarcoFalke 2022-12-19 15:17:41 +01:00
commit 8ab19237e1
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -204,6 +204,9 @@ class KeyPoolTest(BitcoinTestFramework):
res = w2.walletcreatefundedpsbt(inputs=[], outputs=[{destination: 0.00010000}], options={"subtractFeeFromOutputs": [0], "feeRate": 0.00010, "changeAddress": addr.pop()})
assert_equal("psbt" in res, True)
if not self.options.descriptors:
msg = "Error: Private keys are disabled for this wallet"
assert_raises_rpc_error(-4, msg, w2.keypoolrefill, 100)
if __name__ == '__main__':
KeyPoolTest().main()