Commit graph

3520 commits

Author SHA1 Message Date
Byron Hambly
ac05517749
feat: change getnewblockhex to take multiple commitments
Modifies the getnewblockhex json rpc call to accept an array of
commitments instead of a single commitment.

Backwards compatibility is maintained by first attempting to parse as a
string for a singular commitment.

(cherry picked from commit 661c6c7094)
2022-10-11 16:12:14 +02:00
Steven Roose
7b00e1e5e4
Merge branch 'master' into elements-0.21 2022-03-02 13:22:05 +00:00
Glenn Willen
bf7f050aeb Raise max P2P message size to account for larger elements dynafed header size 2022-03-01 14:21:52 -08:00
Steven Roose
e76337b48c
Merge branch 'master' into release-elements-0.21.0.1 2021-11-29 17:36:11 +00:00
Pablo Greco
85c3c2b819 Deprecate con_dyna_deploy_start in favor of evbparams 2021-11-23 14:36:03 +00:00
Pablo Greco
24cafa50cf Implement vbparams for Elements (evbparams) 2021-11-23 14:36:03 +00:00
Andrew Poelstra
af441ca7bb Merge branch 'master' into 2021-10--rc2 2021-10-06 23:13:15 +00:00
Andrew Poelstra
6eed792d43
Merge ElementsProject/elements#1050: wallet: fix a pile of bugs in transaction funding logic
a67a2df330 pset: remove one more intermediate-zero check from the blinding logic (Andrew Poelstra)
9eb285c19d test: add test for confidential non-wallet-owned change (Andrew Poelstra)
185d473fe8 walletcreatefundedpsbt: add functional test for blinding edge cases (Andrew Poelstra)
533da12c2c wallet: make sure extra OP_RETURN output is blinded when called from fundraw (Andrew Poelstra)
b09b63bd1b pset: allow input blinding factors to sum to zero, or value to be 0 (Andrew Poelstra)
9afcb83baf wallet: correctly handle blinding of manually-set change addresses (Andrew Poelstra)
9813c3e74a wallet: fix "cannot unblind IsMine output" check in SignPSBT (Andrew Poelstra)
7103471fd5 walletcreatefundedpsbt: signal blinding data correctly to `FundTransaction` (Andrew Poelstra)

Pull request description:

  Fixes #1049

  Needs backport to 0.21 (and a new rc).

  Although there are several bugs here, none affect the functionaries. There is a more thorough summary in the second-to-last commit message.

ACKs for top commit:
  achow101:
    ACK a67a2df330

Tree-SHA512: 25066c29f080e43cd00c5b33c60a986a8cb5bbf4ca01ceb3b4182c5b8f61979a1d6d946b8f28fa871ec90f44bdb6fc22014b5c11280cf081181db102cd588cdf
2021-10-02 15:13:45 +00:00
Andrew Poelstra
fec0b59112 pset: make sure combinepsbt doesn't crash when explicit values are missing
I accidentally dropped this check (and its test) in the previous
commits. Restore both.
2021-10-01 20:10:27 +00:00
Andrew Poelstra
187c8094bb combinepsbt: only use explicit values if the corresponding proofs pass 2021-10-01 17:17:41 +00:00
Andrew Poelstra
9eb285c19d test: add test for confidential non-wallet-owned change 2021-09-30 22:58:14 +00:00
Andrew Poelstra
185d473fe8 walletcreatefundedpsbt: add functional test for blinding edge cases
This test actually hits almost all of the edge cases covered by the
previous commits.

  1. The "`walletcreatefundedpsbt` does not propagate blinding factors"
     issue is actually covered by several existing tests, which did not
     fail, but which revealed other bugs as soon as I fixed the issue.

  2. Similarly, the "properly blind (or don't blind) explicit change
     addresses" issue was covered by existing tests, but was revealed
     upon fixing the issue with verifying unblindability in SignPSBT,
     since it resulted in using the wrong blinding key to produce
     rangeproofs for change.

  2a. (While addressing this, I was able to test the SignPSBT checks
      extensively, because the code was producing bad rangeproofs. But
      in the final result this is *not* covered, since it is hard, or
      hopefully impossible, to cajole the wallet into producing outputs
      that can't be unblinded now.)

  3. Once that was fixed, the existing tests create an output whose
     total blinding factor (`v_b + v*a_b`) is zero, which it does by
     having no blinded inputs, explicit change/fee, and a single
     blinded output. This output is spent in the new test. This tests
     one of the "blinding may fail due to zero intermediate values"
     cases.

  4. The new test then intentionally tests that `walletcreatefundedpsbt`
     creates OP_RETURN outputs only when it is legitimately given a
     "blinded inputs, no blinded outputs" transaction, which tests the
     original bug (that blinding factors were propagated correctly from
     `walletfundpsbt`).

  5. In doing so, it hit the "OP_RETURN outputs are not blinded when
     called from fundrawtransaction" bug.

  6. And once this was fixed, `BlindPSBT` has to blind a zero-valued
     output, which triggers the other "blinding may fail due to zero
     intermediate values" case.

For purposes of assigning blame, I'd say that half of this omnibug came
from the new PSET logic and half was latent in Elements for years. The
most concerning thing, I'd say, is the "explicit change addresses cause
outputs to be blinded to the wrong key" bug, which I believe has been
around for the entire history of Elements.
2021-09-30 22:46:33 +00:00
Andrew Chow
78cd67d4de Test that signrawtx works when a signed CSV and CLTV inputs are present
Github-Pull: #21166
Rebased-From: a97a9298ce
(cherry picked from commit f79189ca54)
2021-09-22 02:05:02 +00:00
Andrew Chow
c4494ede6b tests: Test that a fully signed tx given to signrawtx is unchanged
Tests that a fully signed transaction given to
signrawtransactionwithwallet is both unchanged and marked as complete.
This tests for a regression in 0.20 where the transaction would not be
marked as complete.

Github-Pull: #20562
Rebased-From: 773c42b265
(cherry picked from commit 36ecf5eb87)
2021-09-22 02:05:02 +00:00
Jon Atack
08298c34d8 test: disallow sendtoaddress/sendmany when private keys disabled
Github-Pull: #21201
Rebased-From: 6bfbc97d71
(cherry picked from commit 4ef1e4bd40)
2021-09-22 02:05:02 +00:00
MarcoFalke
7233f69fc4 util: Disallow negative mocktime
Signed-off-by: practicalswift <practicalswift@users.noreply.github.com>

Github-Pull: #21043
Rebased-From: 3ddbf22ed1
(cherry picked from commit 08dada8456)
2021-09-22 02:05:02 +00:00
Bruno Garcia
16e2673e24 fix the unreachable code at feature_taproot
Github-Pull: #21081
Rebased-From: 5e0cd25e29
(cherry picked from commit 4607019798)
2021-09-22 02:05:02 +00:00
Vasil Dimov
de31f16d60 test: add test for banning of non-IP addresses
Co-authored-by: Jon Atack <jon@atack.com>

Github-Pull: #20852
Rebased-From: 39b43298d9
(cherry picked from commit bdce029191)
2021-09-22 02:05:02 +00:00
Jon Atack
e48a9793b2 test: add coverage for passing fee rate as a string
Github-Pull: #20573
Rebased-From: 6fa72ceb80
(cherry picked from commit 0d3c140c4d)
2021-09-22 02:05:01 +00:00
Jon Atack
b4eb953986 wallet, bugfix: allow send to take string fee rate values
Github-Pull: #20573
Rebased-From: ce207d6b93
(cherry picked from commit 06c84232b3)
2021-09-22 02:05:01 +00:00
Pieter Wuille
f15c72cbd2 Send and require SENDADDRV2 before VERACK
See the corresponding BIP change: https://github.com/bitcoin/bips/pull/1043

Github-Pull: #20564
Rebased-From: 1583498fb6
(cherry picked from commit bead935470)
2021-09-22 02:05:01 +00:00
Jon Atack
d635fc743a Update feeRate (BTC/kvB) to fee_rate (sat/vB) in wallet_bumpfee
as the feeRate argument should soon be deprecated.

Also loosen one test (and a similar one) that caused a one-off CI failure with:
expected message
'Insufficient total fee 0.00000141, must be at least 0.00001704 (oldFee 0.00000999 + incrementalFee 0.00000705)'
actual message
'Insufficient total fee 0.00000141, must be at least 0.00001712 (oldFee 0.00001007 + incrementalFee 0.00000705)'

Github-Pull: #20426
Rebased-From: 3f1e10b2b1
(cherry picked from commit 6e4969f76f)
2021-09-22 02:05:01 +00:00
Jon Atack
765c2b4d17 Allow zero-fee fundrawtxn and walletcreatefundedpsbt calls
A check to raise an error on zero-fee txns was mistakenly extended in commit
a0d4957 from the bumpfee and send{toaddress, many} RPCs to also include
fundrawtransaction and walletcreatefundedpsbt.

This commit overrides zero fee rate checking for these two RPCs, not only for
the feeRate (BTC/kvB) arg to return to previous behavior, but also for the new
fee_rate (sat/vB) arg.

Github-Pull: #20426
Rebased-From: 1b3d700928
(cherry picked from commit 54e1edcc2b)
2021-09-22 02:05:01 +00:00
Jon Atack
df1bd79314 wallet: fix and improve upgradewallet error responses
(cherry picked from commit ca8cd893bb)
2021-09-22 02:05:01 +00:00
Jon Atack
77627d8efd wallet: fix and improve upgradewallet result responses
(cherry picked from commit 99d56e3571)
2021-09-22 02:05:01 +00:00
Andrew Chow
92251542e5 Don't upgrade to HD split if it is already supported
It is unnecessary to upgrade to FEATURE_HD_SPLIT if this feature is
already supported by the wallet. Because upgrading to FEATURE_HD_SPLIT
actually requires upgrading to FEATURE_PRE_SPLIT_KEYPOOL, users would
accidentally be upgraded to FEATURE_PRE_SPLIT_KEYPOOL instead of nothing
being done.

Fixes the issue described at
https://github.com/bitcoin/bitcoin/pull/20403#discussion_r526063920

(cherry picked from commit 2498b04ce8)
2021-09-22 02:05:01 +00:00
MarcoFalke
ae26ff27a9 wallet: Do not treat default constructed types as None-type
(cherry picked from commit fa69c2c784)
2021-09-22 02:05:01 +00:00
MarcoFalke
029b6799d1 test: Fix intermittent issue in mempool_compatibility
(cherry picked from commit fa05d19bd6)
2021-09-22 02:05:01 +00:00
Luke Dashjr
4f36e4cfc6 RPC/Wallet: unloadwallet: Clarify docs/error when both the RPC endpoint and wallet_name parameter specify a wallet
(cherry picked from commit b1f59d55d9)
2021-09-22 02:05:01 +00:00
Anthony Towns
5412789739 tests: shrink feature_taproot transfer of funds tx
(cherry picked from commit 7ffac12545)
2021-09-22 02:05:01 +00:00
Andrew Poelstra
d1a1d19113 test: add decodepsbt and analyzepsbt tests for blinding proofs 2021-09-21 21:59:16 +00:00
Andrew Poelstra
71c9e90fa0 test: add another functional test for rangeproofs in issuances 2021-09-20 22:10:50 +00:00
Andrew Poelstra
d4a0b6285a test: check asset issuances with SIGHASH_RANGEPROOF
Asset issuance rangeproofs are not actually covered by SIGHASH_RANGEPROOF
so this test serves more as a sanity check that our various signing
mechanisms still work with issuances. Sure enough, it uncovered a PSET
bug (fixed) and a blindrawtransaction bug (left a FIXME).
2021-09-19 20:58:07 +00:00
Andrew Poelstra
0907fa0f6f test: support asset issuance in test framework sighashes
Replaces #932
2021-09-19 20:58:07 +00:00
Andrew Poelstra
34eafaf761 test: sign using the PSET interface and SIGHASH_RANGEPROOF 2021-09-19 14:52:47 +00:00
Andrew Poelstra
7d39e430c7 test: check that signrawtransaction does not erase RANGEPROOF signatures 2021-09-19 14:18:13 +00:00
Andrew Poelstra
ac54a2f765 test: check that signing with the RANGEPROOF flag works 2021-09-19 14:10:21 +00:00
Andrew Poelstra
f7f9555792
Merge ElementsProject/elements#1044: Define Taproot activation parameters for Liquid
3cb9612faa test: add test for Taproot activation (Andrew Poelstra)
5291c0d9d9 chainparams: add undocumented regtest/testnet only -con_taproot_signal_start option (Andrew Poelstra)
cc6b933478 add missing taproot activation params for Liquid v1 (Andrew Poelstra)
bec6bcf31b versionbits: allow specific deployments to override the signalling/threshold values (Andrew Poelstra)

Pull request description:

  Sets Taproot to start signalling around noon (California time) on Nov 1, 2021, assuming 95% of blocks are produced between now and then.

  Will activate after one week of 100% signalling. If we can pull this off on the first or second try, we will beat Bitcoin which currently looks like it will activate on Nov 16.

  **Edit:** actually, even without Speedy Trial, there is one full period (week) where Taproot will be "locked in" but not "active". So it will activate on Nov 15 at the earliest.

ACKs for top commit:
  achow101:
    ACK 3cb9612faa

Tree-SHA512: c3a80d39ba86a0d762a3057cb9c45e379c70c2daee8ff2e54978a4c32118c935c8909d872ac9f873e283441c52c1974c06268f10dc7bf9e9e000c21063ac84d7
2021-09-18 03:22:30 +00:00
Andrew Poelstra
3cb9612faa test: add test for Taproot activation 2021-09-18 00:50:17 +00:00
Andrew Poelstra
388d47f9a3
Merge ElementsProject/elements#1010: Support supplying contract hash to issueasset RPC
47d43f14ad Support supplying contract hash to issueasset RPC (Steven Roose)

Pull request description:

  forward port of https://github.com/ElementsProject/elements/pull/993.
  Closes https://github.com/ElementsProject/elements/issues/985.

ACKs for top commit:
  apoelstra:
    ACK 47d43f14ad

Tree-SHA512: e29cda86291c8fe4650595129af477c6dc8648465a5305002ae521bac21a114d6a1c44738786351ac4355eafdcb0da3e4e42c8f204137f9e31e03df20a91db64
2021-09-16 23:06:23 +00:00
Andrew Poelstra
bc0494cc39
Merge ElementsProject/elements#1040: regtest: change network magic away from liquid v1
e57b4c51ad regtest: change network magic away from liquid v1 (Andrew Poelstra)

Pull request description:

  We don't want connectivity issues between Liquid and custom test networks.

ACKs for top commit:
  stevenroose:
    ACK e57b4c51ad

Tree-SHA512: 3ddd626496d7877551c41b089932784bcb752962089fd3e6baa5e9ea6acac44b1b4c5c915b061892b712849d12455fae00347885cecb0e0a3b59a134d91d4014
2021-09-15 22:36:31 +00:00
Andrew Poelstra
b456b72353
Merge ElementsProject/elements#1039: claimpegin: sanity-check fee in case fallbackfee is disabled, throw explicit exception
fc8bfc1f2c claimpegin: add regression test for behavior when fallbackfee is disabled (Andrew Poelstra)
fd520079a1 claimpegin: sanity-check fee in case fallbackfee is disabled, throw explicit exception (Andrew Poelstra)

Pull request description:

  Produce a much less confusing error message in `claimpegin` in the case that estimatesmartfee fails and no fallbackfee is set.

ACKs for top commit:
  stevenroose:
    ACK fc8bfc1f2c

Tree-SHA512: 2ae658ab3dc90b7319d047c192401a0dcc97e015e45b5b0db71db1d89d63605ba107312d8b4cf1c4aaef72437aa20aa33b442744f64fc08535b15610e6f4a526
2021-09-15 22:36:08 +00:00
Steven Roose
47d43f14ad
Support supplying contract hash to issueasset RPC 2021-09-15 16:23:32 -01:00
Andrew Poelstra
250c8e59d5
Merge ElementsProject/elements#1030: [forward port] When validation is waiting for parent chain daemon, "stall"
b2e1cc38de Regression test for pegin validation issues during sync (Glenn Willen)
d5042b41c8 Finish removing 'recheckpeginblockinterval'; move MainchainRPCCheck (Glenn Willen)
313f73d5b2 When validation is waiting for parent chain daemon, "stall". (Andrew Poelstra)

Pull request description:

  Forward-port of #1022

ACKs for top commit:
  gwillen:
    utACK b2e1cc38de, verified that it contains only the requested changes from da11d7b6fd.

Tree-SHA512: 971b6a137efdc54f84995b17595346bf3d3ebd5a04eef1676225c664923e0b52393550bc51ea366c4d3010aa35a9de16da0643bb5bfb40c7eb788a180c99b1a0
2021-09-14 20:48:05 +00:00
Andrew Chow
3ac7e78a84 pset, rpc: Better error messages for imbalance failure conditions
Instead of not failing and silently allowing bad PSETs to be created,
provide error messages that explain why the operation the user did was
wrong. Specifically for combining PSETs such that they would become
fully blinded but have imbalanced values and blinders, and for blinding
a PSET when the wallet has a blind input but no outputs to blind (would
result in an imbalance).
2021-09-13 18:36:38 -04:00
Glenn Willen
b2e1cc38de Regression test for pegin validation issues during sync
Add a regression test for https://github.com/ElementsProject/elements/issues/891 .

This checks that we can sync successfully when making a bunch of new blocks
just as we have transient loss of parent daemon connectivity. This reliably
fails without the fix, and reliably succeeds with it. (It stands in for the
situation, more common in production, where we sync faster than the parent
daemon can keep up after a long outage.)
2021-09-13 22:10:36 +00:00
Andrew Poelstra
313f73d5b2 When validation is waiting for parent chain daemon, "stall".
Currently, if -validatepegin is given, and block validation can't proceed
because the parent chain is not synced, we mark the block invalid and put
it in a queue to be "revalidated" later. Unfortunately, marking a block
invalid has downstream consequences, in particular causing descendant blocks
to be marked invalid, which are not currently fixed by the queue.

Instead, we'll use a different strategy: if the mainchain daemon isn't
sufficiently synced to validate a block, we will "stall" connecting that
block to the chain, and have ActivateBestChain simply keep the tip at the
previous block until we're ready.

We can still download and validate (partly) blocks past this point while
we're waiting. They will be connected once the parent chain daemon catches
up.
2021-09-13 22:10:09 +00:00
Andrew Chow
a7ef9f325d pset, test: Test a PSET coinjoin workflow 2021-09-11 21:02:22 -04:00
Andrew Chow
59f65a3f73 rpc, pset: Include blinded value and asset proofs in decodepsbt 2021-09-11 20:58:40 -04:00
Andrew Poelstra
e57b4c51ad regtest: change network magic away from liquid v1
We don't want connectivity issues between Liquid and custom test networks.
2021-09-10 17:20:20 +00:00