Commit graph

3467 commits

Author SHA1 Message Date
Andrew Poelstra
a2b9606552 Merge 7060d2d97a into merged_master (Bitcoin PR #18350) 2020-11-26 01:07:56 +00:00
Andrew Poelstra
665487ce94 Merge bef78a0447 into merged_master (Elements PR #828) 2020-11-26 01:07:56 +00:00
Andrew Poelstra
5c5d93eb64 Merge d402c1e4d3 into merged_master (Bitcoin PR #18345) 2020-11-26 01:07:55 +00:00
Andrew Poelstra
93c7d0d22d Merge e2d36639ca into merged_master (Bitcoin PR #18228) 2020-11-26 01:07:55 +00:00
Andrew Poelstra
e747991568 Merge 2737197ff3 into merged_master (Bitcoin PR #18213) 2020-11-26 01:07:54 +00:00
Andrew Poelstra
cc5099dcd6 Merge 9cc7eba1b5 into merged_master (Bitcoin PR #18318) 2020-11-26 01:07:54 +00:00
Andrew Poelstra
ad33c3a204 Merge 309b0c4c19 into merged_master (Bitcoin PR #13693) 2020-11-26 01:07:54 +00:00
Andrew Poelstra
7bc1e4d084 Merge 24a727e23e into merged_master (Bitcoin PR #18255) 2020-11-26 01:07:53 +00:00
Andrew Poelstra
bf899b9e7f Merge 16dfaed1b7 into merged_master (Bitcoin PR #18304) 2020-11-26 01:07:52 +00:00
Andrew Poelstra
9259d819c1 Merge b5c7665e30 into merged_master (Bitcoin PR #18311) 2020-11-26 01:07:52 +00:00
Andrew Poelstra
f3b377f05b Merge cf4cb28efc into merged_master (Bitcoin PR #18305) 2020-11-26 01:07:52 +00:00
Andrew Poelstra
f19177a927 Merge 1a97c9a483 into merged_master (Bitcoin PR #15443) 2020-11-26 01:07:52 +00:00
Andrew Poelstra
9352c087d1 Merge ccb2c9e789 into merged_master (Bitcoin PR #18306) 2020-11-26 01:07:52 +00:00
Andrew Poelstra
6b887e82dc Merge d0601e67f1 into merged_master (Bitcoin PR #17812) 2020-11-26 01:07:49 +00:00
Andrew Poelstra
e6e0bcc70d Merge cbc32d67dc into merged_master (Bitcoin PR #18249) 2020-11-26 01:07:49 +00:00
Andrew Poelstra
cdeb19ce22 Merge 088604221b into merged_master (Bitcoin PR #18253) 2020-11-26 01:07:48 +00:00
Andrew Poelstra
01aa5b3023 Merge 1f886243e4 into merged_master (Bitcoin PR #18224)
Added a new "signed but not finalized" vector to the functional tests, which took
some time to figure out how to generate. Evenetually I took the output of walletsignpsbt
from the nonconf->nonconf test and manually un-finalized that by pulling the
scriptwitness apart into a pubkey->signature mapping.
2020-11-26 01:07:48 +00:00
Andrew Poelstra
feb99445da Merge 9aa8145bc0 into merged_master (Bitcoin PR #17959) 2020-11-26 01:07:47 +00:00
Andrew Poelstra
4bc1e03e5d Merge e5753fa4e8 into merged_master (Bitcoin PR #17921) 2020-11-26 01:07:47 +00:00
Andrew Poelstra
87ff0bd466 Merge eae48ec84c into merged_master (Bitcoin PR #18209) 2020-11-26 01:07:46 +00:00
Andrew Poelstra
acf499a048 Merge 1615043935 into merged_master (Bitcoin PR #17461) 2020-11-26 01:07:46 +00:00
Andrew Poelstra
dcc1b1a31e Merge 89a97a71f2 into merged_master (Bitcoin PR #17985) 2020-11-26 01:07:46 +00:00
Andrew Poelstra
a0e2e69cfd Merge 31c0006a6c into merged_master (Bitcoin PR #17264) 2020-11-26 01:07:45 +00:00
Andrew Poelstra
1f0738f05f Merge e9fc8f6e7f into merged_master (Bitcoin PR #18172) 2020-11-26 01:07:44 +00:00
Andrew Poelstra
36b191b752 Merge 68e841e0af into merged_master (Bitcoin PR #18067) 2020-11-26 01:07:44 +00:00
Andrew Poelstra
947e32f011 Merge 051439813e into merged_master (Bitcoin PR #13339) 2020-11-26 01:07:43 +00:00
Andrew Poelstra
bca8bce3b7 Merge caa2f3af29 into merged_master (Bitcoin PR #12134) 2020-11-26 01:07:42 +00:00
Andrew Poelstra
dd22beb3b3 Merge e5ab941489 into merged_master (Elements PR #813) 2020-11-26 01:07:41 +00:00
Andrew Poelstra
bcf509470b Merge 75fb37ce68 into merged_master (Bitcoin PR #18032) 2020-11-26 01:07:40 +00:00
Andrew Poelstra
9a8c2b0e3f Merge 8a56f79d49 into merged_master (Bitcoin PR #17482) 2020-11-26 01:07:40 +00:00
Andrew Poelstra
34033c4586 Merge bd5c4c6971 into merged_master (Bitcoin PR #18069)
More diff reduction :)
2020-11-26 00:29:44 +00:00
Andrew Poelstra
f1406e762c Merge f32564f0a7 into merged_master (Bitcoin PR #16681)
Basically purely reduction of Core/Elements diff :) thanks jtimon
2020-11-26 00:29:44 +00:00
Andrew Poelstra
ca0936ab69 Merge 6d0e532ae0 into merged_master (Bitcoin PR #17585) 2020-11-26 00:29:43 +00:00
MarcoFalke
80e32e120e
Merge #20305: wallet: introduce fee_rate sat/vB param/option
05e82d86b0 wallet: override minfee checks (fOverrideFeeRate) for fee_rate (Jon Atack)
9a670b4f07 wallet: update sendtoaddress, send RPC examples with fee_rate (Jon Atack)
be481b72e2 wallet: use MIN_RELAY_TX_FEE in bumpfee help (Jon Atack)
449b730579 wallet: provide valid values if invalid estimate mode passed (Jon Atack)
6da3afbaee wallet: update remaining rpcwallet fee rate units to BTC/kvB (Jon Atack)
173b5b5fe0 wallet: update fee rate units, use sat/vB for fee_rate error messages (Jon Atack)
7f9835a05a wallet: remove fee rates from conf_target helps (Jon Atack)
b7994c01e9 wallet: add fee_rate unit warnings to bumpfee (Jon Atack)
410e471fa4 wallet: remove redundant bumpfee fee_rate checks (Jon Atack)
a0d4957473 wallet: introduce fee_rate (sat/vB) param/option (Jon Atack)
e21212f01b wallet: remove unneeded WALLET_BTC_KB_TO_SAT_B constant (Jon Atack)
6112cf20d4 wallet: add CFeeRate ctor doxygen documentation (Jon Atack)
3f72791613 wallet: fix bug in RPC send options (Jon Atack)

Pull request description:

  This PR builds on #11413 and #20220 to address #19543.

  - replace overloading the conf_target and estimate_mode params with `fee_rate` in sat/vB in the sendtoaddress, sendmany, send, fundrawtransaction, walletcreatefundedpsbt, and bumpfee RPCs

  - allow non-actionable conf_target value of `0` and estimate_mode value of `""` to be passed to use `fee_rate` as a positional argument, in addition to as a named argument

  - fix a bug in the experimental send RPC described in https://github.com/bitcoin/bitcoin/pull/20220#discussion_r513789526 where args were not being passed correctly into the options values

  - update the feerate error message units for these RPCs from BTC/kB to sat/vB

  - update the test coverage, help docs, doxygen docs, and some of the RPC examples

  - other changes to address the excellent review feedback

  See this wallet meeting log for more context: http://www.erisian.com.au/bitcoin-core-dev/log-2020-11-06.html#l-309

ACKs for top commit:
  achow101:
    re-ACK 05e82d8
  MarcoFalke:
    review ACK 05e82d86b0 did not test and found a few style nits, which can be fixed later 🍯
  Xekyo:
    tACK 05e82d86b0
  Sjors:
    utACK 05e82d86b0

Tree-SHA512: a4ee5f184ada53f1840b2923d25873bda88c5a2ae48e67eeea2417a0b35154798cfdb3c147b05dd56bd6608a784e1b91623bb985ee2ab9ef2baaec22206d0a9c
2020-11-17 13:49:12 +01:00
Wladimir J. van der Laan
c48e788246
Merge #18836: wallet: upgradewallet fixes and additional tests
5f9c0b6360 wallet: Remove -upgradewallet from dummywallet (MarcoFalke)
a314271f08 test: Remove unused wallet.dat (MarcoFalke)
bf7635963c tests: Test specific upgradewallet scenarios and that upgrades work (Andrew Chow)
4b418a9dec test: Add test_framework/bdb.py module for inspecting bdb files (Andrew Chow)
092fc43485 tests: Add a sha256sum_file function to util (Andrew Chow)
0bd995aa19 wallet: upgrade the CHDChain version number when upgrading to split hd (Andrew Chow)
8e32e1c41c wallet: remove nWalletMaxVersion (Andrew Chow)
bd7398cc62 wallet: have ScriptPubKeyMan::Upgrade check against the new version (Andrew Chow)
5f720544f3 wallet: Add GetClosestWalletFeature function (Andrew Chow)
842ae3842d wallet: Add utility method for CanSupportFeature (Andrew Chow)

Pull request description:

  This PR cleans up the wallet upgrade mechanism a bit, fixes some probably bugs, and adds more test cases.

  The `nWalletMaxVersion` member variable has been removed as it made `CanSupportFeature` unintuitive and was causing a couple of bugs. The reason this was introduced originally was to allow a wallet upgrade to only occur when the new feature is first used. While this makes sense for the old `-upgradewallet` option, for an RPC, this does not quite make sense. It's more intuitive for an upgrade to occur if possible if the `upgradewallet` RPC is used as that's an explicit request to upgrade a particular wallet to a newer version. `nWalletMaxVersion` was only relevant for upgrades to `FEATURE_WALLETCRYPT` and `FEATURE_COMPRPUBKEY` both of which are incredibly old features. So for such wallets, the behavior of `upgradewallet` will be that the feature is enabled immediately without the wallet needing to be encrypted at that time (note that `FEATURE_WALLETCRYPT` indicates support for encryption, not that the wallet is encrypted) or for a new key to be generated.

  `CanSupportFeature` would previously indicate whether we could upgrade to `nWalletMaxVersion` not just whether the current wallet version supported a feature. While this property was being used to determine whether we should upgrade to HD and HD chain split, it was also causing a few bugs. Determining whether we should upgrade to HD or HD chain split is resolved by passing into `ScriptPubKeyMan::Upgrade` the version we are upgrading to and checking against that. By removing `nWalletMaxVersion` we also fix a bug where you could upgrade to HD chain split without the pre-split keypool.

  `nWalletMaxVersion` was also the version that was being reported by `getwalletinfo` which meant that the version reported was not always consistent across restarts as it depended on whether `upgradewallet` was used. Additionally to make the wallet versions consistent with actually supported versions, instead of just setting the wallet version to whatever is given to `upgradewallet`, we normalize the version number to the closest supported version number. For example, if given 150000, we would store and report 139900.

  Another bug where CHDChain was not being upgraded to the version supporting HD chain split is also fixed by this PR.

  Lastly several more tests have been added. Some refactoring to the test was made to make these tests easier. These tests check specific upgrading scenarios, such as from non-HD (version 60000) to HD to pre-split keypool. Although not specifically related to `upgradewallet`, `UpgradeKeyMetadata` is now being tested too.

  Part of the new tests is checking that the wallet files are identical before and after failed upgrades. To facilitate this, a utility function `sha256sum_file` has been added. Another part of the tests is to examine the wallet file itself to ensure that the records in the wallet.dat file have been correctly modified. So a new `bdb.py` module has been added to deserialize the BDB db of the wallet.dat file. This format isn't explicitly documented anywhere, but the code and comments in BDB's source code in file `dbinc/db_page.h` describe it. This module just dumps all of the fields into a dict.

ACKs for top commit:
  MarcoFalke:
    approach ACK 5f9c0b6360
  laanwj:
    Code review ACK 5f9c0b6360
  jonatack:
    ACK 5f9c0b6360, approach seems fine, code review, only skimmed the test changes but they look well done, rebased on current master, debug built and verified the `wallet_upgradewallet.py` test runs green both before and after running `test/get_previous_releases.py -b v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2`

Tree-SHA512: 7c4ebf420850d596a586cb6dd7f2ef39c6477847d12d105fcd362abb07f2a8aa4f7afc5bfd36cbc8b8c72fcdd1de8d2d3f16ad8e8ba736b6f4f31f133fe5feba
2020-11-16 11:03:25 +01:00
Andrew Poelstra
6f123becd3 Merge 1d1f8bbf57 into merged_master (Bitcoin PR #16115) 2020-11-14 19:07:24 +00:00
Andrew Poelstra
4c7d6ec20e Merge 3b69310beb into merged_master (Bitcoin PR #17984) 2020-11-14 18:40:28 +00:00
Andrew Poelstra
68d0a25901 Merge 1326092e6c into merged_master (Bitcoin PR #17156)
This fixes a segfault I introduced in 981df590811 (#17371) a couple hundred PRs
ago, where we might out-of-bounds access the vout arrray of a non_witness_utxo
transaction in a PSBT.

This logic should probably be refactored after the rebase -- we sift through
the non_witness_utxos to find a scriptpubkey, which we use to get a wallet
provider, so we can pass this to SignPSBTInput, which then repeats the same
logic (for its own reasons, and without the segfault bug)....and we aren't
even calling SignPSBTInput for signing reasons! It has something to do with
blinding.
2020-11-14 16:52:12 +00:00
Andrew Poelstra
17a72c9c14 Merge c26b05c2b7 into merged_master (Bitcoin PR #17770) 2020-11-14 16:52:11 +00:00
Andrew Poelstra
1b7df1d514 Merge 95ca6aeec7 into merged_master (Bitcoin PR #17691) 2020-11-14 16:52:08 +00:00
Andrew Poelstra
b5dd54f5cd Merge ec9b964cc9 into merged_master (Bitcoin PR #17541) 2020-11-14 16:52:08 +00:00
Andrew Poelstra
d308abd052 Merge 4e8b564df0 into merged_master (Bitcoin PR #17931) 2020-11-14 16:52:07 +00:00
Andrew Poelstra
8bbbb28dae Merge ac61ec9da6 into merged_master (Bitcoin PR #17843) 2020-11-14 16:52:07 +00:00
Andrew Poelstra
7c53615bb6 Merge af05bd9e1e into merged_master (Bitcoin PR #17891) 2020-11-14 16:52:07 +00:00
Andrew Poelstra
eb8d73022f Merge f8c69677a1 into merged_master (Bitcoin PR #17893) 2020-11-14 16:52:06 +00:00
Andrew Poelstra
32b9383743 Merge 295211e668 into merged_master (Bitcoin PR #17445) 2020-11-14 16:52:05 +00:00
Andrew Poelstra
74d2e8da1b Merge 7ea3b85ecf into merged_master (Bitcoin PR #17578) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
c0f55c006c Merge 45f151913e into merged_master (Bitcoin PR #16373) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
4f611f400d Merge bcb4cdcca3 into merged_master (Bitcoin PR #17621) 2020-11-14 16:52:04 +00:00
Andrew Poelstra
c4e2622681 Merge 3f8dbcd655 into merged_master (Bitcoin PR #16658) 2020-11-14 16:52:03 +00:00