aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcdump.cpp
AgeCommit message (Collapse)Author
2019-08-23Encapsulate tx status in a Confirmation structAntoine Riard
Instead of relying on combination of hashBlock and nIndex values to manage tx in its lifecycle, we introduce 4 status : CONFIRMED, UNCONFIRMED, CONFLICTED, ABANDONED. hashBlock and nIndex magic values should only be used at serialization/deserialization for backward-compatibility. At block disconnection, we know flag txn as UNCONFIRMED where previously they kept their states until being override by a block connection or abandontransaction call. This is a change in behavior for which user may have to call abandon twice if transaction is disconnected and not accepted back in the mempool. We assert status transitioning right in AddToWallet. Doing so flagged a misbehavior in ComputeTimeSmart unit test where same tx is confirmed twice in different block. To avoid inconsistencies we unconfirmed tx before new connection in different block. We also remove a cs_main lock in test, as AddToWallet and its callees don't rely on locked chain.
2019-08-16Give more errors for specific failure conditionsAndrew Chow
Some failure conditions implicitly fail by failing some other check. But the error messages are more helpful if they say explicitly what actually caused the failure, so add those as failure conditions and errors.
2019-08-16Return an error from descriptor Parse that gives more information about what ↵Andrew Chow
failed
2019-07-26Merge #16301: Use CWallet::Import* functions in all import* RPCsMarcoFalke
40ad2f6a58228c72c655e3061a19a63640419378 Have importwallet use ImportPrivKeys and ImportScripts (Andrew Chow) 78941da5baf6244c7c54e86cf8ce3e09ce60c239 Optionally allow ImportScripts to set script creation timestamp (Andrew Chow) 94bf156f391759420465b2ff8c44f5f150246c7f Have importaddress use ImportScripts and ImportScriptPubKeys (Andrew Chow) a00d1e5ec5eb019f8bbeb060a2b09e341d360fe5 Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functions (Andrew Chow) c6a827424711333f6f66cf5f9d79e0e6884769de Have importprivkey use CWallet's ImportPrivKeys, ImportScripts, and ImportScriptPubKeys (Andrew Chow) fae7a5befd0b8746d84a6fde575e5b4ea46cb3c4 Log when an import is being skipped because we already have it (Andrew Chow) ab28e31c9563bd2cd1e4a088ffd2479517dc83f2 Change ImportScriptPubKeys' internal to apply_label (Andrew Chow) Pull request description: #15741 introduced `ImportPrivKeys`, `ImportPubKeys`, `ImportScripts`, and `ImportScriptPubKeys` in `CWallet` which are used by `importmulti`. This PR changes the remaining `import*` RPCs (`importaddress`, `importprivkey`, `importpubkey`, and `importwallet`) to use these functions as well instead of directly adding the imported items to the wallet. ACKs for top commit: MarcoFalke: ACK 40ad2f6a58228c72c655e3061a19a63640419378 (checked that behavior changes are mentioned in the commit body) ryanofsky: utACK 40ad2f6a58228c72c655e3061a19a63640419378. Only change since last review is a tweaked commit message (mentioning label update in importpubkey commit) Sjors: ACK 40ad2f6a5. Those extra tests also pass. Tree-SHA512: 910e3bbe20b6f8809a47b7293775db234125615d886c7fd99c194f4cdf00c765eb1e24b1799260f1213b98c88f9bbe696796f36087c182925e567d44e9194c98
2019-07-24Have importwallet use ImportPrivKeys and ImportScriptsAndrew Chow
Behavior changes: * An "Importing ..." line is logged for every key, even ones that are skipped
2019-07-24Optionally allow ImportScripts to set script creation timestampAndrew Chow
Behavior changes: * scripts imported in importmulti that are not explicilty scriptPubKeys will have timestamps set for them
2019-07-24Have importaddress use ImportScripts and ImportScriptPubKeysAndrew Chow
Also removes the now unused ImportAddress and ImportScript from rpcdump.cpp Behavior changes: * No errors will be thrown when the script or key already exists in the wallet. * If the key or script is already in the wallet, their labels will be updated.
2019-07-24Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functionsAndrew Chow
Behavior changes: * If any scripts for the pubkey were already in the wallet, their timestamps will be set to 1 and label updated
2019-07-24scripted-diff: Make translation bilingualHennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i 's/inline std::string _(const char\* psz)/inline bilingual_str _(const char\* psz)/' src/util/translation.h sed -i 's/return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;/return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};/' src/util/translation.h sed -i 's/\b_("\([^"]\|\\"\)*")/&.translated/g' $(git grep --files-with-matches '\b_("' src) echo Hard cases - multiline strings. sed -i 's/"Visit %s for further information about the software.")/&.translated/g' src/init.cpp sed -i "s/\"Only rebuild the block database if you are sure that your computer's date and time are correct\")/&.translated/g" src/init.cpp sed -i 's/" restore from a backup.")/&.translated/g' src/wallet/db.cpp sed -i 's/" or address book entries might be missing or incorrect.")/&.translated/g' src/wallet/wallet.cpp echo Special case. sed -i 's/_(COPYRIGHT_HOLDERS)/&.translated/' src/util/system.cpp test/lint/lint-format-strings.py -END VERIFY SCRIPT-
2019-07-24Refactor out translation.hHennadii Stepanov
This is a prerequisite for introducing bilingual error messages. Note: #includes are arranged by clang-format-diff.py script.
2019-07-18Have importprivkey use CWallet's ImportPrivKeys, ImportScripts, and ↵Andrew Chow
ImportScriptPubKeys Behavior changes: * If we already have the key, it's wpkh script will still be added, although it should already be there
2019-07-11Change ImportScriptPubKeys' internal to apply_labelAndrew Chow
The internal bool was only to indicate whether the given label should be applied as things that are internal should not have a label. To make this clearer, we change internal to apply_label and invert its usage so things that have labels set this to true in order to have their labels applied.
2019-07-08rpc: switch to using RPCHelpMan.Check()Karl-Johan Alm
2019-06-07Merge #15024: Allow specific private keys to be derived from descriptorWladimir J. van der Laan
53b7de629d3d9281dc6f8fa10e32c4cdec59c140 Add test for dumping the private key imported from descriptor (MeshCollider) 2857bc4a64cc8dc7914bc984ac878397ac64292d Extend importmulti descriptor tests (MeshCollider) 81a884bbd0dbee108d11776794d9627ca07504aa Import private keys from descriptor with importmulti if provided (MeshCollider) a4d1bd1a29be2dcc5e00c63b6b41916b1c466de0 Add private key derivation functions to descriptors (MeshCollider) Pull request description: ~This is based on #14491, review the last 3 commits only.~ Currently, descriptors have an Expand() function which returns public keys and scripts for a specific index of a ranged descriptor. But the private key for a specific index is not given. This allows private keys for specific indices to be derived. This also allows those keys to be imported through the `importmulti` RPC rather than having to provide them separately. ACKs for commit 53b7de: achow101: ACK 53b7de629d3d9281dc6f8fa10e32c4cdec59c140 Tree-SHA512: c060bc01358a1adc76d3d470fefc2bdd39c837027f452e9bc4bd2e726097e1ece4af9d5627efd942a5f8819271e15ba54f010b169b50a9435a1f0f40fd1cebf3
2019-06-06Import private keys from descriptor with importmulti if providedMeshCollider
2019-06-02Make reasoning about dependencies easier by not including unused dependenciespracticalswift
2019-05-29Merge #15741: Batch write imported stuff in importmultiMeshCollider
0db94e55d wallet: Pass WalletBatch to CWallet::UnsetWalletFlag (João Barbosa) 6cb888b37 Apply the batch treatment to CWallet::SetAddressBook via ImportScriptPubKeys (Ben Woosley) 6154a09e0 Move some of ProcessImport into CWallet::Import* (Ben Woosley) ccb26cf34 Batch writes for importmulti (Andrew Chow) d6576e349 Have WalletBatch automatically flush every 1000 updates (Andrew Chow) 366fe0be0 Add AddWatchOnlyWithDB, AddKeyOriginWithDB, AddCScriptWithDB functions (Andrew Chow) Pull request description: Instead of writing each item to the wallet database individually, do them in batches so that the import runs faster. This was tested by importing a ranged descriptor for 10,000 keys. Current master ``` $ time src/bitcoin-cli -regtest -rpcwallet=importbig importmulti '[{"desc": "sh(wpkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*))#3w7php47", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]' ... real 7m45.29s ``` This PR: ``` $ time src/bitcoin-cli -regtest -rpcwallet=importbig4 importmulti '[{"desc": "pkh([73111820/44h/1h/0h]tpubDDoT2SgEjaU5rerQpfcRDWPAcwyZ5g7xxHgVAfPwidgPDKVjm89d6jJ8AQotp35Np3m6VaysfUY1C2g68wFqUmraGbzhSsMF9YBuTGxpBaW/1/*)#v65yjgmc", "range": [0, 10000], "timestamp": "now", "internal": true, "keypool": false, "watchonly": true}]' ... real 3.93s ``` Fixes #15739 ACKs for commit 0db94e: jb55: utACK 0db94e5 ariard: Tested ACK 0db94e5 Empact: re-utACK https://github.com/bitcoin/bitcoin/pull/15741/commits/0db94e55dcbbfc741df463c404818d9033b4fff1 only change is re the privacy of `UnsetWalletFlagWithDB` and `AddCScriptWithDB`. Tree-SHA512: 3481308a64c99b6129f7bd328113dc291fe58743464628931feaebdef0e6ec770ddd5c19e4f9fbc1249a200acb04aaf62a8d914d53b0a29ac1e557576659c0cc
2019-05-28Move some of ProcessImport into CWallet::Import*Ben Woosley
This maintains encapsulation of CWallet::database in the face of batching, e.g. allows making the `WithDB` methods private.
2019-05-22Merge #16063: rpc: Mention getwalletinfo where a rescan is triggeredMarcoFalke
be4efb165a rpc: Mention getwalletinfo where a rescan is triggered (João Barbosa) Pull request description: ACKs for commit be4efb: jonasschnelli: utACK be4efb165ab7ff5824de9a46aa06eca654b7513f sipa: utACK be4efb165ab7ff5824de9a46aa06eca654b7513f Tree-SHA512: c9e5adda6fcb71dd64ad35cc5af89b0ed815aba440df26b61ef2018abd3b801c9e93cdbedf90db3938e88dc9af39f1577c4c7248bc77260d3afda5e2a0928e68
2019-05-22rpc: Mention getwalletinfo where a rescan is triggeredJoão Barbosa
2019-05-22RPC: Hint for importmulti in help output of importpubkey and importaddressKristaps Kaupe
2019-05-18Batch writes for importmultiAndrew Chow
When writing all of the imported data to the wallet, use a common WalletBatch object so that batch writes are done and the writes finish more quickly. AddKeypoolPubkey is no longer needed so it is also removed
2019-05-16Merge #15870: wallet: Only fail rescan when blocks have actually been prunedMarcoFalke
fa7e311e16 [doc] rpcwallet: Only fail rescan when blocks have been pruned (MarcoFalke) aaaa57c2aa scripted-diff: Bump copyright headers in wallet (MarcoFalke) faf3729242 wallet: Only fail rescan when blocks have actually been pruned (MarcoFalke) Pull request description: This brings the behaviour of the import* calls closer to importmulti. After this change, the difference between importmulti and the other import* calls is * that in importmulti you can "opt-out" of scanning early blocks by setting a later timestamp. * that in importmulti the wallet will successfully import the data, but fail to rescan. Whereas in the other calls, the wallet will abort before importing the data. ACKs for commit fa7e31: promag: utACK fa7e311e169349bfcf1dab8b980724e8ddf4e749. jnewbery: utACK fa7e311e169349bfcf1dab8b980724e8ddf4e749 Tree-SHA512: a57d52ffea94b64e0eb9b5d3a7a63031325833908297dd14eb0c5251ffea3b2113b131003f1db4e9599e014369165a57f107a7150bb65e4c791e5fe742f33cb8
2019-05-15[doc] rpcwallet: Only fail rescan when blocks have been prunedMarcoFalke
2019-05-10Merge #15744: refactor: Extract ParseDescriptorRangeMarcoFalke
510c6532ba Extract ParseDescriptorRange (Ben Woosley) Pull request description: So as to be consistently informative when the checks fail, and to protect against unintentional divergence among the checks. ACKs for commit 510c65: meshcollider: Oh apologies, yes. Thanks :) utACK https://github.com/bitcoin/bitcoin/pull/15744/commits/510c6532bae9abc5beda1c126c945923a64680cb MarcoFalke: utACK 510c6532bae9abc5beda1c126c945923a64680cb sipa: utACK 510c6532bae9abc5beda1c126c945923a64680cb Tree-SHA512: b1f0792bfaa163890a20654a0fc2c4c4a996659916bf5f4a495662436b39326692a1a0c825caafd859e48c05f5dd1865c4f7c28092be5074edda3c94f94f9f8b
2019-05-06scripted-diff: Bump copyright headers in walletMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./src/wallet/ -END VERIFY SCRIPT-
2019-05-06wallet: Only fail rescan when blocks have actually been prunedMarcoFalke
2019-04-29GetKeyBirthTimes should return key ids, not destinationsGregory Sanders
2019-04-29Replace CScriptID and CKeyID in CTxDestination with dedicated typesGregory Sanders
2019-04-13Extract ParseDescriptorRangeBen Woosley
So as to be consistently informative when the checks fail, and to protect against unintentional divergence among the checks.
2019-04-06Take non-importing keys into account for spendability warning in descriptor ↵Pieter Wuille
import
2019-04-04Import all origin info in importmulti; even for non-importing pubkeysPieter Wuille
2019-04-04Keep full pubkeys in FlatSigningProvider::originsPieter Wuille
2019-03-27wallet: Move CWallet::ReacceptWalletTransactions locks to callersJoão Barbosa
2019-03-06Remove remaining wallet accesses to node globalsRussell Yanofsky
2019-03-04Merge #15288: Remove wallet -> node global function callsMarcoFalke
f7efd87c8f Change brace formatting (Russell Yanofsky) a1df1b48a8 Remove use of IsInitialBlockDownload in wallet code (Russell Yanofsky) 1106a6fde4 Remove use of uiInterface.LoadWallet in wallet code (Russell Yanofsky) 318f41fb2c circular-dependencies: Avoid treating some .h/.cpp files as a unit (Russell Yanofsky) d02b34c8a8 Remove use of AcceptToMemoryPool in wallet code (Russell Yanofsky) e2c8ba9f6e Remove uses of InitMessage/Warning/Error in wallet code (Russell Yanofsky) c5e59a96a8 Remove uses of GetAdjustedTime in wallet code (Russell Yanofsky) 6d6bcc77c0 Remove use of g_connman / PushInventory in wallet code (Russell Yanofsky) 00dfb2a440 Remove uses of g_connman in wallet code (Russell Yanofsky) cc3836e8f9 Remove uses of fPruneMode in wallet code (Russell Yanofsky) cc02c796d3 Remove uses of fee globals in wallet code (Russell Yanofsky) 1fb0a4a04e Remove use of CalculateMemPoolAncestors in wallet code (Russell Yanofsky) cd32160af0 Remove use of GetTransactionAncestry in wallet code (Russell Yanofsky) 291276f7f4 Remove use of GetCountWithDescendants in wallet code (Russell Yanofsky) bdc6628683 Remove use of IsRBFOptIn in wallet code (Russell Yanofsky) 80f52a2267 Remove uses of CheckFinalTx in wallet code (Russell Yanofsky) Pull request description: This change removes wallet calls to node functions that access global chain and mempool state. This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102. Tree-SHA512: 40dbaf1f59fb22b32e70b054b30ba5638d638aa3240fa30e0f721d53c721cd6138a7ab4d423a24d7d2fda0b956e68d44c733abc2c9259c3d6c9fd6d4be89aa23
2019-02-28Use stop/[start,stop] notation in importmulti desc rangePieter Wuille
2019-02-22Change brace formattingRussell Yanofsky
Suggested https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-197915100
2019-02-22Remove uses of fPruneMode in wallet codeRussell Yanofsky
This commit does not change behavior.
2019-02-16[Doc] importmulti: add missing description of keypool optionDavid A. Harding
2019-02-15Make descriptor checksums mandatory in deriveaddresses and importmultiPieter Wuille
2019-02-14Import public keys in orderAndrew Chow
Do public key imports in the order that they are specified in the import or in the descriptor range.
2019-02-14Add option to importmulti add an imported pubkey to the keypoolAndrew Chow
Adds a new option to importmulti where the pubkeys specified in the import object can be added to the keypool. This only works if the wallet has private keys disabled.
2019-02-14Import KeyOriginData when importing descriptorsAndrew Chow
2019-02-14Store key origin info in key metadataAndrew Chow
Store the master key fingerprint and derivation path in the key metadata. hdKeypath is kept to indicate the seed and for backwards compatibility, but all key derivation path output uses the key origin info instead of hdKeypath.
2019-02-11RPCHelpMan: Check default values are given at compile-timeMarcoFalke
2019-02-08Merge #15365: wallet: Add lock annotation for mapAddressBookMarcoFalke
faa46475d7 wallet: Add lock annotation for mapAddressBook (MarcoFalke) Pull request description: This adds lock annotations for `mapAddressBook` and also moves one lock from inside `GetDestValues` to the caller to be in line with the other methods (`eraseDestData`, `addDestData`, ...) Tree-SHA512: cef9397523e2f5717d4a9a6b2da1fe07042484a51b3c067ae64425768637f334350a2c3db4ab7e00af99b2a587f6b656b68ee1195f6a3db6d47298d0b2b6174a
2019-02-07wallet: Add lock annotation for mapAddressBookMarcoFalke
2019-02-05[wallet] Allow descriptor imports with importmultiMeshCollider
2019-02-05[wallet] Refactor ProcessImport() to call ProcessImportLegacy()John Newbery
This is almost entirely a move-only commit. Reviewer hint: use --color-moved=zebra for review.