Commit graph

21838 commits

Author SHA1 Message Date
Brannon King
9ad7b0c90f fixed small claim names coming out as numeric 2020-03-26 15:39:51 +02:00
Brannon King
9c866832de fixed slow-running unit tests 2020-03-26 15:39:51 +02:00
lbrynaut
9295adeb38 Rebase lbry on to Bitcoin 0.17.
This contains significant rebase / merge / testing work by Naut
<lbrynaut@protonmail.com>, Anthony Fieroni <bvbfan@abv.bg> and Brannon
King <countprimes@gmail.com>.
2020-03-26 15:39:51 +02:00
Pierre Rochard
e3ba14387d Tests: add unit tests for GetWalletEnv
Github-Pull: #11911
Rebased-From: 88b1d95
2020-03-26 15:39:51 +02:00
Russell Yanofsky
02c080af5e Free BerkeleyEnvironment instances when not in use
Instead of adding BerkeleyEnvironment objects permanently to the g_dbenvs map,
use reference counted shared pointers and remove map entries when the last
BerkeleyEnvironment reference goes out of scope.

This change was requested by Matt Corallo <git@bluematt.me> and makes code that
sets up mock databases cleaner. The mock database environment will now go out
of scope and be reset on destruction so there is no need to call
BerkeleyEnvironment::Reset() during wallet construction to clear out prior
state.

This change does affect bitcoin behavior slightly. On startup, instead of same
wallet environments staying open throughout VerifyWallets() and OpenWallets()
calls, VerifyWallets() will open and close an environment once for each wallet,
and OpenWallets() will create its own environment(s) later.

Github-Pull: #11911
Rebased-From: f1f4bb7
2020-03-26 15:39:51 +02:00
Chun Kuan Lee
5847e62f19 wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory.
Github-Pull: #14552
Rebased-From: 15c93f0
2020-03-26 15:39:51 +02:00
João Barbosa
3cf3002e9e wallet: Refactor to use WalletLocation
Github-Pull: #14350
Rebased-From: 65f3672
2020-03-26 15:39:51 +02:00
João Barbosa
595f5c3ca3 wallet: Add WalletLocation utility class
Github-Pull: #14350
Rebased-From: 01a4c09
2020-03-26 15:39:50 +02:00
Andrew Chow
cafa1709b6 Add function to close all Db's and reload the databae environment
Adds a ReloadDbEnv function to BerkeleyEnvironment in order to close all Db
instances, closes the environment, resets it, and then reopens
the BerkeleyEnvironment.

Also adds a ReloadDbEnv function to BerkeleyDatabase that calls
BerkeleyEnvironment's ReloadDbEnv.

Github-Pull: #12493
Rebased-From: 5d296ac
2020-03-26 15:39:50 +02:00
David A. Harding
2558be26e4 [0.17] [Doc] Backport release note about PSBT doc 2020-03-26 15:39:50 +02:00
João Barbosa
b42ce5c0de rpc: Make unloadwallet wait for complete wallet unload
Github-Pull: #14941
Rebased-From: c37851d
2020-03-26 15:39:50 +02:00
João Barbosa
bcb88335ab qt: Add GUIUtil::bringToFront
Github-Pull: #14123
Rebased-From: 5796671e1d
2020-03-26 15:39:50 +02:00
Hennadii Stepanov
cce339ea42 Use Qt signal for macOS Dock icon click event
This moves the Dock icon click reaction code to the common place and
allows some cleanup in obj_c code.

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.

Github-Pull: #14597
Rebased-From: 2464925e7b
2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
5641252942 doc: Clean out release notes post-0.17.1
Tree-SHA512: 0cd6e97156da2dea9a9b557083d8140c17f85f6e718d5fcb73aa67460480b6437b665fad147bf4eacd13570aeb25a29f28c35b7fb0365ae630b2edf05901a431
2020-03-26 15:39:50 +02:00
MarcoFalke
659dcb6c59 rpc: Avoid creating non-standard raw transactions
Github-Pull: #14890
Rebased-From: fa4c8679ed
2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
eea8378f6c doc: Fill in authors and changelog for 0.17.1 release notes
Tree-SHA512: dc23ae43e81ad379b48bb8dc6da21cde647a7edc778563b8b8266dfe84d9baa70bf4565915e276ea0e14aa96ce677547494da0aadeebfcc961f53430c7bb84ea
2020-03-26 15:39:50 +02:00
João Barbosa
4904d21df0 qa: Ensure wallet unload during walletpassphrase timeout
0.17 branch doesn't include #12493 which changed encryptwallet behavior. For that
reason the test is adjusted.

Github-Pull: #14453
Rebased-From: 8907df9
2020-03-26 15:39:50 +02:00
Glenn Willen
2ff659ac91 Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

This simplifies the logic of SignPSBTInput slightly, since it no longer
has to deal with the "both" case. When calling it, we now give it, in
order of preference: (1) whichever of the utxo fields was already
present in the PSBT we received, or (2) if neither, the
non_witness_utxo field, which is just a copy of the input transaction,
which we get from the wallet.

SignPSBTInput no longer has to remove one of the two fields; instead, it
will check if we have a witness signature, and if so, it will replace
the non_witness_utxo with the witness_utxo (which is smaller, as it is
just a copy of the output being spent.)

Add PSBTInput::IsSane checks in two more places, which checks for
both utxo fields being present; we will now give an RPC error early on
if we are supplied such a malformed PSBT to fill in.

Also add a check to FillPSBT, to avoid touching any input that is
already signed. (This is now redundant, since we should no longer
potentially harm an already-signed input, but it's harmless.)

fixes #14473

Github-Pull: #14588
2020-03-26 15:39:50 +02:00
Glenn Willen
248e1132b2 Simplify arguments to SignPSBTInput
Remove redundant arguments to SignPSBTInput -- since it needs several
bits of the PartiallySignedTransaction, pass in a reference instead of
doing it piecemeal. This saves us having to pass in both a PSBTInput and
its index, as well as having to pass in the CTransaction. Also avoid
redundantly passing the sighash_type, which is contained in the
PSBTInput already.

Github-Pull: #14588
Rebased-From: 0f5bda2bd9
2020-03-26 15:39:50 +02:00
Glenn Willen
eaadea01f3 Add bool PSBTInputSigned
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed,
for use in subsequent commits.

Also improve a related comment.

GitHub-Pull: #14588
Rebased-From: 53e6fffb8f
2020-03-26 15:39:50 +02:00
Glenn Willen
cca21e18ea Remove redundant txConst parameter to FillPSBT
Github-Pull: #14588
Rebased-From: 4f3f5cb4b1
2020-03-26 15:39:50 +02:00
Andrew Chow
b7e58f9c1d Convert non-witness UTXOs to witness if witness sig created
If a witness signature was created when a non-witness UTXO is used,
convert the non-witness UTXO to a witness one.
2020-03-26 15:39:50 +02:00
Gregory Sanders
d2611e9d97 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change 2020-03-26 15:39:50 +02:00
MarcoFalke
0050a7e979 qa: Avoid race in p2p_invalid_block by waiting for the block request
Github-Pull: #14700
Rebased-From: fa21568208
2020-03-26 15:39:50 +02:00
Chun Kuan Lee
56df309b1b build: Add bitcoin-tx.exe into Windows installer
Github-Pull: #14698
Rebased-From: 5c5902acc5
2020-03-26 15:39:50 +02:00
gustavonalle
7871dd58fe [wallet] Ensure wallet is unlocked before signing
Github-Pull: #14310
Rebased-From: db15805668
2020-03-26 15:39:50 +02:00
Russell Yanofsky
c33bab30d2 [wallet] Restore ability to list incoming transactions by label
Backport of PR 14411 to v0.17.

This change partially reverts #13075 and #14023.

Fixes #14382
2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
afb4aabe3b doc: Clean out release notes after 0.17.0.1
Tree-SHA512: c04192e3b93537f4b37f5ea55fd455b26dd7d902da3b5f8b59ef6fa4590cf413b72fc11bba330a8fd7fa3938b09e6c1d35171806ab5ce85d6b99681953c291a5
2020-03-26 15:39:50 +02:00
MarcoFalke
70998ac794 qa: Run all tests even if wallet is not compiled
Github-Pull: #14180
Rebased-From: fac9539836
2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
3a102216f4 doc: Update release notes for 0.17.0.1 2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
e4152f67f3 doc: Clean out release notes after release 0.17.0
Tree-SHA512: 0b641fdf4cf4ac6a6f9f5c1b45d65c4449b0d7bb777ba57498e389840ba7a37bfc0569ce5e70f0ac998785fc4eea600ecf6f7c7d83d86513997f4033bcc14a5d
2020-03-26 15:39:50 +02:00
Suhas Daftuar
826219f99c [qa] backport: Test for duplicate inputs within a transaction 2020-03-26 15:39:50 +02:00
Wladimir J. van der Laan
e275004f72 qt: Pre-rc1 translations update
Tree-SHA512: 11d0d6a23f47e428661b33fa175aa97cc6841452c0c55845fdb0a903a0b147cd6df65e8fdab8b98823bf411018d5d85006af8c2cf14597286e9e284764d15041
2020-03-26 15:39:50 +02:00
MarcoFalke
05f5dd96c7
Merge #18218: [0.19] Further 0.19 backports
48fef5ebae gui: Fix race in WalletModel::pollBalanceChanged (Russell Yanofsky)
1964561a3a build: don't embed a build-id when building libdmg-hfsplus (fanquake)

Pull request description:

  These are not blockers for the 0.19.1 release, as per [IRC discussion this morning](http://www.erisian.com.au/bitcoin-core-dev/log-2020-02-27.html#l-331), doesn't look like there will be an rc3. This PR can collect further backports for the 0.19 branch.

  Currently backports:
  * https://github.com/bitcoin/bitcoin/pull/18004 - build: don't embed a build-id when building libdmg-hfsplus
  * https://github.com/bitcoin/bitcoin/pull/18123 - gui: Fix race in WalletModel::pollBalanceChanged

ACKs for top commit:
  promag:
    ACK 48fef5ebae.
  laanwj:
    ACK 48fef5ebae
  luke-jr:
    utACK 48fef5ebae

Tree-SHA512: c7e7ddda9ee7b8015f16d39aab000e0595f85fe073f79abc1a57b3e2adb0dedc4e07e5fd918e1df5e88b7f3fbc39b57ab3382233c4354b9c2196f65fa1fa6c04
2020-03-04 10:24:05 -05:00
Wladimir J. van der Laan
58ba7c314d
build: Bump version for 0.19.1 final
Tree-SHA512: c0a5fbc072b03e36ffb9af23e699c6b3a897fcd509fdc3c6741ecc8e510aea5d87851c5a7926909746d03d390af10cae266189160b4a7b303f8be9418ea6a0c0
2020-03-04 13:14:49 +01:00
Russell Yanofsky
48fef5ebae
gui: Fix race in WalletModel::pollBalanceChanged
Poll function was wrongly setting cached height to the current chain height
instead of the chain height at the time of polling.

This bug could cause balances to appear out of date, and was first introduced
a0704a8996 (r378452145)
Before that commit, there wasn't a problem because cs_main was held during the
poll update.

Currently, the problem should be rare. But if
8937d99ce81a27ae5e1012a28323c0e26d89c50b from #17954 were merged, the problem
would get worse, because the wrong cachedNumBlocks value would be set if the
wallet was polled in the interval between a block being connected and it
processing the BlockConnected notification.

MarcoFalke <falke.marco@gmail.com> also points out that a0704a8996 could lead
to GUI hangs as well, because previously the pollBalanceChanged method, which
runs on the GUI thread, would only make a nonblocking TRY_LOCK(cs_main) call,
but after could make blocking LOCK(cs_main) calls, potentially locking up the
GUI.

Thanks to John Newbery <john@johnnewbery.com> for finding this bug this while
reviewing https://github.com/bitcoin/bitcoin/pull/17954.

Github-Pull: #18123
Rebased-From: bf36a3ccc212ad4d7c5cb8f26d7a22e279fe3cec
2020-02-28 12:07:39 +08:00
fanquake
1964561a3a
build: don't embed a build-id when building libdmg-hfsplus
Github-Pull: #18004
Rebased-From: cb9e88e73a042ff4e1c83289a6f8fa1db03fb093
2020-02-28 12:04:51 +08:00
Wladimir J. van der Laan
a28ea316ed
Merge #18139: doc: Add missing author to 0.19.1 release notes
facbdc0f5e doc: Add missing author to 0.19.1 release notes (MarcoFalke)

Pull request description:

  Commit 88729d8 is in 0.19, but the author is not in the release notes.

ACKs for top commit:
  practicalswift:
    ACK facbdc0f5e - credit where credit is due :)

Tree-SHA512: 5e65bdb6d1e2318143c978f7e69e2c22f09dc257d92c5a88c52da43b12b812ebbe1a9202382545d8dfd3bc1ca1927543cfeb1d2e5d6da98c1e90bc26765cb8b4
2020-02-13 16:27:24 +01:00
MarcoFalke
facbdc0f5e
doc: Add missing author to 0.19.1 release notes 2020-02-13 06:22:07 -08:00
Wladimir J. van der Laan
628103d673
build: Bump version to 0.19.1rc2
Tree-SHA512: 7ba1efdc24835405562b5ff710ed4223d7e4463dffa58721cc9e0f0f0ba90925e59719cb68b31f95cfc632a73ca9a5573e762167eed264c66323828a397b9127
2020-02-10 15:34:02 +01:00
Wladimir J. van der Laan
c3caf2d84c
doc: UNIX manual pages update for rc2
Tree-SHA512: 23fc6e3712608a2d4ccec5ee2d0efdb3f8df8093f555890611039881a78147eee3a5226aade13d750e88be8f6814699424606b32cf7947faa6c034f1ff2dd81a
2020-02-10 15:26:11 +01:00
Wladimir J. van der Laan
e5322d6dad
qt: Pre-rc2 translations update
Tree-SHA512: 18182903fed7034dc16c2d74ebccf992dd5343376d0f02bebaa50be4ff8fd76c9dd59a95524aef326b74b75a921c819063f06ef45fb9980ae87aacbfb7190554
2020-02-10 15:25:40 +01:00
Wladimir J. van der Laan
9bd082e657
doc: Update release notes for rc2
Tree-SHA512: 320576b94b58246ea7f2426e1dbe43cd0222c0ea58cf9a03e75225fcc226384478f39d7f54099d2cecbcf134a639932e7f2033eb3dd38786bb666dbb81aae2d7
2020-02-10 15:21:08 +01:00
Wladimir J. van der Laan
ba0b7e1296
Merge #18079: [0.19] psbt: check that various indexes and amounts are within bounds
f5fb7fca96 psbt: check output index is within bounds before accessing (Andrew Chow)
1cf77a2dc3 Don't calculate tx fees for PSBTs with invalid money values (Andrew Chow)

Pull request description:

  Backport of #17156, non-trivial due to crossing the refactor in #17371

ACKs for top commit:
  laanwj:
    ACK f5fb7fca96

Tree-SHA512: 7aabf9a6b8a8e287a26dfbf73a437a3bc55177bef8fc5149d822ef81b8ef2458e1d718c3a19c73532c5cef0f9bd8144574c7fad90ca89f13a08b44edf3a2656d
2020-02-10 13:55:41 +01:00
Wladimir J. van der Laan
4755037d45
Merge #18083: [0.19] wallet: Reset reused transactions cache
f11872cbf4 wallet: Reset reused transactions cache (Fabian Jahr)

Pull request description:

  Backport of #17843

  Required porting to pre-`WalletBatch`

ACKs for top commit:
  kallewoof:
    Code review ACK f11872cbf4
  laanwj:
    code review ACK f11872cbf4
  meshcollider:
    utACK f11872cbf4

Tree-SHA512: 5cf5f136d1eafb0783c2e6799e3675ebc50997ebb56b379d8a198ac35eb3b32f6b98656760a8b1c821eeac665eb80efb1723dd4e9eb58d2b4d45c4674499bedf
2020-02-10 13:04:13 +01:00
Wladimir J. van der Laan
f55442aa81
Merge #18100: 0.19: Update univalue subtree
5e1728017b Squashed 'src/univalue/' changes from 7890db99d6..98261b1e7b (MarcoFalke)

Pull request description:

  Version bump backported from #18099

ACKs for top commit:
  laanwj:
    ACK fa4d00b569

Tree-SHA512: dc34c98d9b1f450db700633ce7b674a3edf83bd12f3b77b74544a6b24f3e3b1f3c91f40d0ad6c27f82c1b26e88cf7625311b93f00e492a813dbdcca9f461cb5e
2020-02-10 12:09:51 +01:00
MarcoFalke
fa4d00b569
Update univalue subtree 2020-02-09 07:50:08 -08:00
MarcoFalke
5e1728017b Squashed 'src/univalue/' changes from 7890db99d6..98261b1e7b
98261b1e7b Merge #22: Clamp JSON object depth to PHP limit
54c4015415 Clamp JSON object depth to PHP limit
5a58a46671 Merge #21: Remove hand-coded UniValue destructor.
b4cdfc4f47 Remove hand-coded UniValue destructor.
7fba60b5ad Merge #17: [docs] Update readme
4577454e7e Merge #13: Fix typo
ac7e73cda8 [docs] Update readme
4a4964729b Fix typo

git-subtree-dir: src/univalue
git-subtree-split: 98261b1e7be4ce9820e25c8ce37d40cdef19ab20
2020-02-09 07:49:51 -08:00
Andrew Chow
f5fb7fca96 psbt: check output index is within bounds before accessing
Github-Pull: #17156
Rebased-From: deaa6dd144f5650b385658a0c4f9a014aff8dde2
2020-02-06 23:22:30 +00:00
fanquake
7d53995ff2
Merge #18084: 0.19: gui: Fix unintialized WalletView::progressDialog
b4e5363ccc gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport #18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK b4e5363ccc
  jonasschnelli:
    utACK b4e5363ccc

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
2020-02-06 21:18:08 +08:00