Commit graph

24154 commits

Author SHA1 Message Date
practicalswift fd8e99da57 tests: Add fuzzing harness for functions in primitives/transaction.h 2020-04-24 12:16:03 +00:00
MarcoFalke 85bae24d06
Merge #18752: test: Fix intermittent error in mempool_reorg
fae98668d1 test: Fix intermittent error in mempool_reorg (MarcoFalke)

Pull request description:

  Example: https://travis-ci.org/github/bitcoin/bitcoin/jobs/677689899#L4717

  Also speed up tx relay and fix two pep8 errors while touching the file anyway.

ACKs for top commit:
  vasild:
    utACK fae9866

Tree-SHA512: 23a7894e71ad0e1a59c74c73643708fca21b505fa4e980038d554294063fd63c396669eefb233ffdffb0083968e51b702c643cb449df8f656dd8345a20f33907
2020-04-24 07:57:48 -04:00
Sebastian Falbesoner c4027e7350 refactor: test: use wait_for_getdata() in p2p_compactblocks.py 2020-04-24 13:55:20 +02:00
fanquake d8ca51db5d
Merge #18589: Fix naming of macOS SDK and clarify version
eb37275a6f Fix naming of macOS SDK and clarify version (Andrew Chow)

Pull request description:

  Fixes the `MacOSX10.14.sdk.tar.gz` creation command to have `MacOSX.sdk` be correctly named as `MacOSX10.14.sdk` and for the resulting file to be placed in the current directory. Gitian requires that `tar.gz` contains a folder named `MacOSX10.14.sdk` and the command did not do this originally. Having the file be placed in the current directory is a convenience so builders don't have to go find it.

  Also clarifies which version of Xcode to download and where it can be downloaded.

ACKs for top commit:
  fanquake:
    ACK eb37275a6f - tested the macOS and Linux SDK extraction. Also noticed something seemingly broken with Apple `tar`, but will open an issue to follow up.
  Sjors:
    ACK eb37275 for the macOS instruction

Tree-SHA512: d691e14711cf195999291dd6fb7ffe552c86f8b30d2b1a77e88b4db6050dd817ba128b047cf36d29b0bb0d4183e709b7c03aa27f31b64e562ea8cd948434ca55
2020-04-24 17:22:54 +08:00
MarcoFalke fa8b9b5d1f
test: Fix intermittent failure in wallet_importmulti 2020-04-23 19:01:26 -04:00
MarcoFalke fae98668d1
test: Fix intermittent error in mempool_reorg 2020-04-23 18:43:44 -04:00
Amiti Uttarwar 50fc4df6c4 [mempool] Persist unbroadcast set to mempool.dat
Ensure that the unbroadcast set will still be meaningful if the node is
restarted.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar 297a178536 [test] Integration tests for unbroadcast functionality
Check that...
- mempool tracks & reattempts delivery of a transaction where a GETDATA hasn't
  been requested by a peer yet.
- transaction delivery is not attempted again after GETDATA is received.
- transaction is removed from the unbroadcast set when its removed from the
  mempool.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar 6851502472 [refactor/test] Extract P2PTxInvStore into test framework 2020-04-23 14:42:25 -07:00
Amiti Uttarwar dc1da48dc5 [wallet] Update the rebroadcast frequency to be ~1/day.
Since the mempool unbroadcast mechanism handles the reattempts for initial
broadcast, the wallet rebroadcast attempts can be much less frequent
(previously ~1/30 min)
2020-04-23 14:42:25 -07:00
Amiti Uttarwar e25e42f20a [p2p] Reattempt initial send of unbroadcast transactions
Every 10-15 minutes, the scheduler kicks off a job that queues unbroadcast
transactions onto each node.
2020-04-23 14:42:25 -07:00
Amiti Uttarwar 7e93eecce3 [util] Add method that returns random time in milliseconds 2020-04-23 14:42:25 -07:00
Amiti Uttarwar 89eeb4a333 [mempool] Track "unbroadcast" transactions
- Mempool tracks locally submitted transactions (wallet or rpc)
- Transactions are removed from set when the node receives a GETDATA request
  from a peer, or if the transaction is removed from the mempool.
2020-04-23 14:42:25 -07:00
Andrew Chow 223588b1bb Add a --descriptors option to various tests
Adds a --descriptors option globally to the test framework. This will
make the test create and use descriptor wallets. However some tests may
not work with this.

Some tests are modified to work with --descriptors and run with that
option in test_runer:
* wallet_basic.py
* wallet_encryption.py
* wallet_keypool.py
* wallet_keypool_topup.py
* wallet_labels.py
* wallet_avoidreuse.py
2020-04-23 13:59:48 -04:00
Andrew Chow 869f7ab30a tests: Add RPCOverloadWrapper which overloads some disabled RPCs
RPCOverloadWrapper overloads some deprecated or disabled RPCs with
an implementation using other RPCs to avoid having a ton of code churn
around replacing those RPCs.
2020-04-23 13:59:48 -04:00
Andrew Chow cf06062859 Correctly check for default wallet 2020-04-23 13:59:48 -04:00
Andrew Chow 886e0d75f5 Implement CWallet::IsSpentKey for non-LegacySPKMans 2020-04-23 13:59:48 -04:00
Andrew Chow 3c19fdd2a2 Return error when no ScriptPubKeyMan is available for specified type
When a CWallet doesn't have a ScriptPubKeyMan for the requested type
in GetNewDestination, give a meaningful error. Also handle this in
Qt which did not do anything with errors.
2020-04-23 13:59:48 -04:00
Andrew Chow 388ba94231 Change wallet_encryption.py to use signmessage instead of dumpprivkey 2020-04-23 13:59:48 -04:00
Andrew Chow 1346e14831 Functional tests for descriptor wallets 2020-04-23 13:59:48 -04:00
Hugo Nguyen f193ea889d add importdescriptors RPC and tests for native descriptor wallets
Co-authored-by: Andrew Chow <achow101-github@achow101.com>
2020-04-23 13:59:48 -04:00
Andrew Chow ce24a94494 Add IsLegacy to CWallet so that the GUI knows whether to show watchonly 2020-04-23 13:59:48 -04:00
Andrew Chow 1cb42b22b1 Generate new descriptors when encrypting 2020-04-23 13:59:48 -04:00
Andrew Chow 82ae02b165 Be able to create new wallets with DescriptorScriptPubKeyMans as backing 2020-04-23 13:59:48 -04:00
Andrew Chow b713baa75a Implement GetMetadata in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 8b9603bd0b Change GetMetadata to use unique_ptr<CKeyMetadata> 2020-04-23 13:59:48 -04:00
Andrew Chow 72a9540df9 Implement FillPSBT in DescriptorScriptPubKeyMan
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-23 13:59:48 -04:00
Andrew Chow 84b4978c02 Implement SignMessage for descriptor wallets 2020-04-23 13:59:48 -04:00
Andrew Chow bde7c9fa38 Implement SignTransaction in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow d50c8ddd41 Implement GetSolvingProvider for DescriptorScriptPubKeyMan
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-23 13:59:48 -04:00
Andrew Chow f1ca5feb4a Implement GetKeypoolOldestTime and only display it if greater than 0 2020-04-23 13:59:48 -04:00
Andrew Chow 586b57a9a6 Implement ReturnDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow f866957979 Implement GetReservedDestination in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow a775f7c7fd Implement Unlock and Encrypt in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow bfdd073486 Implement GetNewDestination for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 58c7651821 Implement TopUp in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow e014886a34 Implement SetupGeneration for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 46dfb99768 Implement writing descriptorkeys, descriptorckeys, and descriptors to wallet file 2020-04-23 13:59:48 -04:00
Andrew Chow 4cb9b69be0 Implement several simple functions in DescriptorScriptPubKeyMan
Implements a bunch of one liners: UpgradeKeyMetadata, IsFirstRun, HavePrivateKeys,
KeypoolCountExternalKeys, GetKeypoolSize, GetTimeFirstKey, CanGetAddresses,
RewriteDB
2020-04-23 13:59:48 -04:00
Andrew Chow d1ec3e4f19 Add IsSingleType to Descriptors
IsSingleType will return whether the descriptor will give one or multiple scriptPubKeys
2020-04-23 13:59:48 -04:00
Andrew Chow 953feb3d27 Implement loading of keys for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 2363e9fcaa Load the descriptor cache from the wallet file 2020-04-23 13:59:48 -04:00
Andrew Chow 46c46aebb7 Implement GetID for DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow ec2f9e1178 Implement IsHDEnabled in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 741122d4c1 Implement MarkUnusedAddresses in DescriptorScriptPubKeyMan 2020-04-23 13:59:48 -04:00
Andrew Chow 2db7ca765c Implement IsMine for DescriptorScriptPubKeyMan
Adds a set of scriptPubKeys that DescriptorScriptPubKeyMan tracks.
If the given script is in that set, it is considered ISMINE_SPENDABLE
2020-04-23 13:59:48 -04:00
Andrew Chow db7177af8c Add LoadDescriptorScriptPubKeyMan and SetActiveScriptPubKeyMan to CWallet 2020-04-23 13:59:42 -04:00
Andrew Chow 78f8a92910 Implement SetType in DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00
Andrew Chow 834de0300c Store WalletDescriptor in DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00
Andrew Chow d8132669e1 Add a lock cs_desc_man for DescriptorScriptPubKeyMan 2020-04-23 13:25:50 -04:00