aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.cpp
AgeCommit message (Collapse)Author
2020-05-01wallet: Avoid translating RPC errors when loading walletsMarcoFalke
Common errors and warnings should be translated when displayed in the GUI, but not translated when displayed elsewhere. The wallet method CreateWalletFromFile does not know its caller, so this commit changes it to return a bilingual_str to the caller.
2020-04-23add importdescriptors RPC and tests for native descriptor walletsHugo Nguyen
Co-authored-by: Andrew Chow <achow101-github@achow101.com>
2020-04-23Implement GetMetadata in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Change GetMetadata to use unique_ptr<CKeyMetadata>Andrew Chow
2020-04-23Implement FillPSBT in DescriptorScriptPubKeyManAndrew Chow
FillPSBT will add our own scripts to the PSBT if those inputs are ours. If an input also lists pubkeys that we happen to know the private keys for, we will sign those inputs too.
2020-04-23Implement SignMessage for descriptor walletsAndrew Chow
2020-04-23Implement SignTransaction in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement GetSolvingProvider for DescriptorScriptPubKeyManAndrew Chow
Internally, a GetSigningProvider function is introduced which allows for some private keys to be optionally included. This can be called with a script as the argument (i.e. a scriptPubKey from our wallet when we are signing) or with a pubkey. In order to know what index to expand the private keys for that pubkey, we need to also cache all of the pubkeys involved when we expand the descriptor. So SetCache and TopUp are updated to do this too.
2020-04-23Implement GetKeypoolOldestTime and only display it if greater than 0Andrew Chow
2020-04-23Implement ReturnDestination in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement GetReservedDestination in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement Unlock and Encrypt in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement GetNewDestination for DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement TopUp in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement SetupGeneration for DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement writing descriptorkeys, descriptorckeys, and descriptors to wallet ↵Andrew Chow
file
2020-04-23Implement several simple functions in DescriptorScriptPubKeyManAndrew Chow
Implements a bunch of one liners: UpgradeKeyMetadata, IsFirstRun, HavePrivateKeys, KeypoolCountExternalKeys, GetKeypoolSize, GetTimeFirstKey, CanGetAddresses, RewriteDB
2020-04-23Implement loading of keys for DescriptorScriptPubKeyManAndrew Chow
2020-04-23Load the descriptor cache from the wallet fileAndrew Chow
2020-04-23Implement GetID for DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement IsHDEnabled in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement MarkUnusedAddresses in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Implement IsMine for DescriptorScriptPubKeyManAndrew Chow
Adds a set of scriptPubKeys that DescriptorScriptPubKeyMan tracks. If the given script is in that set, it is considered ISMINE_SPENDABLE
2020-04-23Implement SetType in DescriptorScriptPubKeyManAndrew Chow
2020-04-23Introduce DescriptorScriptPubKeyMan as a dummy classAndrew Chow
2020-04-23Introduce SetType function to tell ScriptPubKeyMans the type and ↵Andrew Chow
internal-ness of it
2020-04-18Merge #17219: wallet: allow transaction without change if keypool is emptySamuel Dobson
92bcd70808b9cac56b184903aa6d37baf9641b37 [wallet] allow transaction without change if keypool is empty (Sjors Provoost) 709f8685ac37510aa145ac259753583c82280038 [wallet] CreateTransaction: simplify change address check (Sjors Provoost) 5efc25f9638866941028454cfa9bae27f1519cb4 [wallet] translate "Keypool ran out" message (Sjors Provoost) Pull request description: Extracted from #16944 First this PR simplifies the check when generating a change address, by dropping `CanGetAddresses` and just letting `reservedest.GetReservedDestination` do this check. Second, when the keypool is empty, instead of immediately giving up, we create a dummy change address and pass that to coin selection. If we didn't need the change address (e.g. when spending the entire balance), then it's all good. If we did need a change address, we throw the original error. ACKs for top commit: fjahr: Code review ACK 92bcd70808b9cac56b184903aa6d37baf9641b37 jonasschnelli: utACK 92bcd70808b9cac56b184903aa6d37baf9641b37 achow101: ACK 92bcd70808b9cac56b184903aa6d37baf9641b37 meshcollider: Code review ACK 92bcd70808b9cac56b184903aa6d37baf9641b37 Tree-SHA512: 07b8c8251f57061c58a85ebf0359be63583c23bac7a2c4cefdc14820c0cdebcc90a2bb218e5ede0db11d1e204cda149e056dfd18614642070b3d56efe2735006
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-03-14Replace std::to_string with locale-independent alternativeBen Woosley
2020-03-09Replace GetSigningProvider with GetSolvingProviderAndrew Chow
Not all ScriptPubKeyMans will be able to provide private keys, but pubkeys and scripts should be. So only provide public-only SigningProviders, i.e. ones that can help with Solving.
2020-03-09Move direct calls to MessageSign into new SignMessage functions in CWallet ↵Andrew Chow
and ScriptPubKeyMan Instead of getting a SigningProvider and then going to MessageSign, have ScriptPubKeyMan handle the message signing internally.
2020-03-09Move key and script filling and signing from CWallet::FillPSBT to ↵Andrew Chow
ScriptPubKeyMan::FillPSBT Instead of fetching a SigningProvider from ScriptPubKeyMan in order to fill and sign the keys and scripts for a PSBT, just pass that PSBT to a new FillPSBT function that does all that for us.
2020-03-08Add SignTransaction function to ScriptPubKeyMan and LegacyScriptPubKeyManAndrew Chow
2020-03-02wallet/spkm: make GetOldestKeyPoolTime() constKarl-Johan Alm
The method checks the oldest key time for key pools and returns the oldest. It does no modifications.
2020-03-02wallet: make CanGetAddresses() constKarl-Johan Alm
CWallet::CanGetAddresses() is used to check whether the wallet has available or is able to produce keys for addresses. It uses the ScriptPubKeyMan::CanGetAddresses(), which in turn uses the const KeypoolCountExternalKeys() method, all which do counting and no modifications.
2020-03-02wallet: make KeypoolCountExternalKeys() constKarl-Johan Alm
This method returns the sum of the key pool sizes. It does no modification.
2020-03-02wallet: make CanGenerateKeys() constKarl-Johan Alm
This method simply checks if HD is or can be enabled and does not require mutability.
2020-02-12wallet: Improve LegacyScriptPubKeyMan::CanProvide script recognitionRussell Yanofsky
Make LegacyScriptPubKeyMan::CanProvide method able to recognize p2sh scripts when the redeem script is present in the mapScripts map without the p2sh script also having to be added to the mapScripts map. This restores behavior prior to https://github.com/bitcoin/bitcoin/pull/17261, which I think broke backwards compatibility with old wallet files by no longer treating addresses created by `addmultisigaddress` calls before #17261 as solvable. The reason why tests didn't fail with the CanProvide implementation in #17261 is because of a workaround added in 4a7e43e8460127a40a7895519587399feff3b682 "Store p2sh scripts in AddAndGetDestinationForScript", which masked the problem for new `addmultisigaddress` RPC calls without fixing it for multisig addresses already created in old wallet files. This change adds a lot of comments and allows reverting commit 4a7e43e8460127a40a7895519587399feff3b682 "Store p2sh scripts in AddAndGetDestinationForScript", so the AddAndGetDestinationForScript() function, CanProvide() method, and mapScripts map should all be more comprehensible
2020-02-04[wallet] translate "Keypool ran out" messageSjors Provoost
2020-01-23Refactor: Replace SigningProvider pointers with unique_ptrsAndrew Chow
Needed for future ScriptPubKeyMans which may need to create SigningProviders dynamically and thus a normal pointer is not enough This commit does not change behavior.
2020-01-23Refactor: Copy CWallet signals and print function to LegacyScriptPubKeyManAndrew Chow
This commit does not change behavior.
2020-01-23Box the wallet: Add multiple keyman maps and loopsAndrew Chow
Add wallet logic for dealing with multiple ScriptPubKeyMan instances. This doesn't change current behavior because there is still only a single LegacyScriptPubKeyMan. But in the future the new logic will be used to support descriptor wallets.
2020-01-23HD Split: Avoid redundant upgradesAndrew Chow
This avoids repeaded upgrades when support for more multiple keyman references is added in the next commit: https://github.com/bitcoin/bitcoin/pull/16341#discussion_r322370108
2020-01-23Locking: Lock cs_KeyStore instead of cs_wallet in legacy keymanAndrew Chow
This commit only affects locking behavior and doesn't have other changes.
2019-12-17Merge #17537: wallet: Cleanup and move opportunistic and superfluous TopUp()sfanquake
6e77a7b65cda1b46ce42f0c99ca91562255aeb28 keypool: Add comment about TopUp and when to use it (Andrew Chow) ea50e34b287e0da0806c1116bb55ade730e8ff6c keypool: Move opportunistic TopUps from LegacyScriptPubKeyMan to CWallet and ReserveDestination (Andrew Chow) bb2c8ce23c9d7ba8d0e5538243e07218443c85b4 keypool: Remove superfluous topup from CWallet::GetNewChangeDestination (Andrew Chow) Pull request description: * The `TopUp()` in `CWallet::GetNewChangeDestination` is unnecessary as currently m_spk_man calls TopUp further down the call stack inside LegacyScriptPubKeyMan::ReserveKeyFromKeyPool (called by LegacyScriptPubKeyMan::GetReservedDestination). This also lets us prepare for future changes with multiple ScriptPubKeyMans in the wallet. * An opportunistic `TopUp()` is moved from `LegacyScriptPubKeyMan::GetNewDestination` to `CWallet::GetNewDestination`. * Another opportunistic `TopUp()` is moved from `LegacyScriptPubKeyMan::ReserveKeyFromKeyPool` Moving opportunistic TopUps ensures that ScriptPubKeyMans will always be topped up before requesting Destinations from them as we cannot always rely on future ScriptPubKeyMan implementaions topping up internally. See also: https://github.com/bitcoin/bitcoin/pull/17373#discussion_r348598174 ACKs for top commit: instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/17537/commits/6e77a7b65cda1b46ce42f0c99ca91562255aeb28 only change is slight elaboration on comment ryanofsky: Code review ACK 6e77a7b65cda1b46ce42f0c99ca91562255aeb28. Only the comment changed since my previous review. Tree-SHA512: bdfc8d303842c3fb7c3d40af7abfa6d9dac4ef71a24922bb92229674ee89bfe3113ebb46d3903ac48ef99f0a7d6eaac33282495844f2b31f91b8df55084c421f
2019-12-06Replace LegacyScriptPubKeyMan::IsCrypted with ↵Andrew Chow
LegacyScriptPubKeyMan::HasEncryptionKeys
2019-12-06Remove SetCrypted() and fUseCrypto; Change IsCrypted()'s implementationAndrew Chow
Removes SetCrypted() and fUseCrypto as we don't need them anymore. SetCrypted calls in LegacyScriptPubKeyMan are replaced with mapKeys.empty() IsCrypted() is changed to just call HasEncryptionKeys()
2019-12-06Rename EncryptKeys to Encrypt and pass in the encrypted batch to useAndrew Chow
2019-12-06Clear mapKeys before encryptingAndrew Chow
Does not change behavior. Needed to make AddCryptedKeyInner() work with SetCrypted() being gone.
2019-12-06Move fDecryptionThoroughlyChecked from CWallet to LegacyScriptPubKeyManAndrew Chow