mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 20:49:30 +02:00
wallet: Use util::Error throughout AddWalletDescriptor
32023 changed AddWalletDescriptor to return util::Error, but did not change all of the failure cases to do so. This may result in some callers continuing when there was actually an error. Unify all of the failure cases to use util::Error so that all callers handle AddWalletDescriptor errors in the same way. The encapsulated return type is changed from ScriptPubKeyMan* to std::reference_wrapper<DescriptorScriptPubKeyMan>. This avoids having a value that can be interpreted as a bool, and also removes the need to constantly dynamic_cast the returned value. The only kind of ScriptPubKeyMan that can come out of AddWalletDescriptor is a DescriptorScriptPubKeyMan anyways.
This commit is contained in:
@@ -284,11 +284,11 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
assert_equal(wpriv.getwalletinfo()['keypoolsize'], 21)
|
||||
|
||||
self.test_importdesc({**range_request, "range": [5, 10]}, wallet=wpriv, success=False,
|
||||
error_code=-8, error_message='new range must include current range = [0,20]')
|
||||
error_code=-4, error_message=f"Could not add descriptor '{range_request['desc']}': new range must include current range = [0,20]")
|
||||
self.test_importdesc({**range_request, "range": [0, 10]}, wallet=wpriv, success=False,
|
||||
error_code=-8, error_message='new range must include current range = [0,20]')
|
||||
error_code=-4, error_message=f"Could not add descriptor '{range_request['desc']}': new range must include current range = [0,20]")
|
||||
self.test_importdesc({**range_request, "range": [5, 20]}, wallet=wpriv, success=False,
|
||||
error_code=-8, error_message='new range must include current range = [0,20]')
|
||||
error_code=-4, error_message=f"Could not add descriptor '{range_request['desc']}': new range must include current range = [0,20]")
|
||||
assert_equal(wpriv.getwalletinfo()['keypoolsize'], 21)
|
||||
|
||||
self.log.info("Check we can change descriptor internal flag")
|
||||
|
Reference in New Issue
Block a user