Commit graph

599 commits

Author SHA1 Message Date
Pablo Greco
20c5630f8c
Merge pull request #1277 from delta1/issues-1259
fix: assert failure on non-policy asset consolidation in CreateTransactionInternal
2023-10-27 12:38:05 -03:00
James Dorfman
e02024e53f test: add new elements_code_tutorial functional test 2023-10-27 15:23:36 +00:00
Byron Hambly
d3ffd2a380
test: add functional test for issue #1259
Adds a functional test to cover the issue uncovered in #1259, where
calling fundrawtransaction with many non-policy inputs and no policy
recipients results in an assertion failure and a crash.

Fixed in #1258.

(cherry picked from commit a8b0ed6f96)
2023-10-23 16:43:20 +02:00
Byron Hambly
5326676ff3
fix: segfault on getpeginaddress rpc when not in elements mode
Fixes https://github.com/ElementsProject/elements/issues/1263

When not running in Elements mode, GetValidFedpegScripts returns an
empty vector. Subsequently `calculate_contract` is called with
`fedpegscripts.front().second` which is a null reference. This reference
is passed into `MatchLiquidWatchman` which tries to dereference the null
reference and causes a segfault.

This fix throws an exception in `getpeginaddress` if fedpegscripts is
empty, returning an error to the RPC caller. It also adds a functional
regression test.
2023-10-18 13:02:51 +02:00
Byron Hambly
4d825cd58d test: specify legacy wallet for failing functional tests on macos13
In the "macOS 13 native arm64 [gui, sqlite only]" CI task, the
test_runner defaults to descriptor wallets, causing some Elements
specific tests to fail.

This commit explicitly runs those tests with `--legacy-wallet`.
2023-10-09 20:32:28 +00:00
Byron Hambly
6f90a02548 Merge 30308cc380 into merged_master (Bitcoin PR bitcoin/bitcoin#20196) 2023-07-03 11:17:52 +00:00
Byron Hambly
7a7253639a Merge 267917f563 into merged_master (Bitcoin PR bitcoin/bitcoin#23304) 2023-07-03 10:06:51 +00:00
Byron Hambly
ca0735a437 Merge 003523d239 into merged_master (Bitcoin PR bitcoin/bitcoin#24338) 2023-06-30 20:58:14 +00:00
Byron Hambly
2aa75b6d6d Merge 9392e1350c into merged_master (Bitcoin PR bitcoin/bitcoin#24195) 2023-06-30 09:45:52 +00:00
Byron Hambly
a0335c7205 Merge dd405add6e into merged_master (Bitcoin PR bitcoin/bitcoin#24154) 2023-06-28 15:36:18 +00:00
Byron Hambly
ccd7b72d79 Merge e30b6ea194 into merged_master (Bitcoin PR bitcoin/bitcoin#24067) 2023-06-28 14:48:32 +00:00
Byron Hambly
cf8b1b2142 Merge 121d47afe3 into merged_master (Bitcoin PR bitcoin/bitcoin#23799) 2023-06-15 08:22:45 +00:00
Byron Hambly
d4d86665fd Merge 31f385c138 into merged_master (Bitcoin PR bitcoin/bitcoin#23532) 2023-06-14 17:35:43 +00:00
Byron Hambly
87960114d8 Merge 2f26d8ec70 into merged_master (Bitcoin PR bitcoin/bitcoin#23725) 2023-06-12 12:36:20 +00:00
Byron Hambly
b0b2f3deff Merge f6013265b7 into merged_master (Bitcoin PR bitcoin/bitcoin#20295) 2023-06-06 09:10:04 +00:00
James Dorfman
669c52f7e8 Merge 4fd0ce75c5 into merged_master (Bitcoin PR bitcoin/bitcoin#22689) 2023-06-02 15:34:33 +00:00
Byron Hambly
f936d6d2fa Merge 877f3aa85c into merged_master (Bitcoin PR bitcoin/bitcoin#23686) 2023-06-02 11:11:36 +00:00
Byron Hambly
60beb95b69 Merge 32d9f3770a into merged_master (Bitcoin PR bitcoin/bitcoin#23596) 2023-06-02 08:38:00 +00:00
James Dorfman
b7ee0e8b7f Merge aef8c7cf82 into merged_master (Bitcoin PR bitcoin/bitcoin#23289) 2023-06-01 05:52:23 +00:00
Byron Hambly
eb7b15c660 Merge 4f8b1f8759 into merged_master (Bitcoin PR bitcoin/bitcoin#23608) 2023-05-31 10:24:48 +00:00
Byron Hambly
00f2e32c8e Merge 47fe7445e7 into merged_master (Bitcoin PR bitcoin/bitcoin#22364)
- some fixmes in this commit, related to invalid schnorr signatures
  which need investigation
2023-05-29 12:58:36 +00:00
Byron Hambly
bd68371fb6 Merge ffdab41f94 into merged_master (Bitcoin PR bitcoin/bitcoin#23474) 2023-05-26 10:32:04 +00:00
Byron Hambly
1beaa601b4 Merge 5ccab7187b into merged_master (Bitcoin PR bitcoin/bitcoin#23394)
- commented out some script tests that need to be fixed
 - commented out feature_taproot.py since it needs significant updates
2023-05-26 09:14:20 +00:00
James Dorfman
432b8883ec Merge 41a1b5f58c into merged_master (Bitcoin PR bitcoin/bitcoin#23046) 2023-05-24 18:31:31 +00:00
James Dorfman
b83a6e56ae Merge 8251316acb into merged_master (Bitcoin PR bitcoin/bitcoin#23153) 2023-05-24 18:23:31 +00:00
Byron Hambly
99318f43e8 Merge d565d9b56d into merged_master (Bitcoin PR bitcoin/bitcoin#23312) 2023-05-16 09:35:07 +00:00
Byron Hambly
a4a976ee6f Merge ff65b696f3 into merged_master (Bitcoin PR bitcoin/bitcoin#22067) 2023-05-12 10:02:36 +00:00
Byron Hambly
cca3f919f8 Merge 9e530c6352 into merged_master (Bitcoin PR bitcoin/bitcoin#20487) 2023-05-09 11:22:04 +00:00
Byron Hambly
4d68eaa81b Merge 4e1de1fc59 into merged_master (Bitcoin PR bitcoin/bitcoin#22340) 2023-04-28 13:51:41 +00:00
James Dorfman
2aed101cd6 Merge 6a5381a06b into merged_master (Bitcoin PR bitcoin/bitcoin#20591) 2023-04-27 06:03:18 +00:00
James Dorfman
ff57e1e65f Merge d6492d4ed0 into merged_master (Bitcoin PR bitcoin/bitcoin#22650) 2023-04-27 04:55:34 +00:00
Byron Hambly
e49e0232f9 Merge efa227f5df into merged_master (Bitcoin PR bitcoin/bitcoin#23097) 2023-04-26 13:17:13 +00:00
Byron Hambly
a93fce1f01 fixup! FIXME commented out failing tests for wallet_groups, taphash_pegins, tapscript_opcodes 2023-04-26 11:26:10 +00:00
Byron Hambly
f522e9232b FIXME commented out failing tests for wallet_groups, taphash_pegins, tapscript_opcodes 2023-04-26 11:03:02 +00:00
James Dorfman
82d02480bd Merge 7d7d5e8efd into merged_master (Bitcoin PR bitcoin/bitcoin#22879) 2023-04-21 01:37:33 +00:00
James Dorfman
5b302d366b Merge 489beb3984 into merged_master (Bitcoin PR bitcoin/bitcoin#22641) 2023-04-11 01:24:28 +00:00
Byron Hambly
8599606ab3 Merge 21438d55d5 into merged_master (Bitcoin PR bitcoin/bitcoin#21800) 2023-04-09 05:08:13 +00:00
Byron Hambly
d7c38ee168
Merge 10fbb37268 into merged_master (Bitcoin PR bitcoin/bitcoin#22098) 2023-04-04 19:29:03 +02:00
Glenn Willen
fac566dd39 Merge 93878d2ab5 into merged_master (Bitcoin PR bitcoin/bitcoin#22423) 2023-03-28 00:59:31 +00:00
James Dorfman
17e6efe7fe Merge 5d83e7d714 into merged_master (Bitcoin PR bitcoin/bitcoin#21090)
We comment out a newly-added assert from the Bitcoin
side, because it's unclear how to replicate it
correctly in Elements.

Co-authored-by: Glenn Willen <gwillen@nerdnet.org>
2023-03-22 01:11:20 +00:00
Andrew Poelstra
3c896b11e0
test: rename elements_regression_1172 to follow naming convention 2022-09-20 21:17:50 +00:00
Andrew Poelstra
fac694be4c
wallet: don't clear out all the blinding data when dropping change
The Elements 22 blinding logic has an edge case where when we drop change,
leaving only a single blinded output, we recompute a bunch of blinding
data to handle the potential for us to have 0 inputs and 1 output to blind.
(BlindTransaction will fail in this case because it cannot make the
transaction balance with only one output to mess with.)

In this recomputation, we dropped more data than we meant to, causing us
to incorrectly blind an output.
2022-09-20 17:40:47 +00:00
Byron Hambly
661c6c7094
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.
2022-09-07 14:43:10 +02:00
Vasil Dimov
7d64ea4a01
net: only assume all local addresses if listening on any
If `-bind=` is provided then we would bind only to a particular address
and should not add all the other addresses of the machine to the list of
local addresses.

Fixes https://github.com/bitcoin/bitcoin/issues/20184 (case 4.)
2022-03-02 15:42:40 +01:00
Vasil Dimov
0cfc0cd322
net: fix GetListenPort() to derive the proper port
`GetListenPort()` uses a simple logic: "if `-port=P` is given, then we
must be listening on `P`, otherwise we must be listening on `8333`".
This is however not true if `-bind=` has been provided with `:port` part
or if `-whitebind=` has been provided. Thus, extend `GetListenPort()` to
return the port from `-bind=` or `-whitebind=`, if any.

Fixes https://github.com/bitcoin/bitcoin/issues/20184 (cases 1. 2. 3. 5.)
2022-03-02 15:42:37 +01:00
laanwj
267917f563
Merge bitcoin/bitcoin#23304: wallet: Derive inactive HD chains in additional places
c4d76c6faa tests: Tests for inactive HD chains (Andrew Chow)
8077862c5e wallet: Refactor TopUp to be able to top up inactive chains too (Andrew Chow)
70134eb34f wallet: Properly set hd chain counters when loading (Andrew Chow)
961b9e4e40 wallet: Parse hdKeypath if key_origin is not available (Andrew Chow)
0652ee73ec Add size check on meta.key_origin.path (Rob Fielding)

Pull request description:

  Currently inactive HD chains are only derived from at the time a key in that chain is found to have been used. However, at that time, the wallet may not be able to derive keys (e.g. it is locked). Currently we would just move on and not derive any new keys, however this could result in missing funds.

  This PR resolves this problem by adding memory only variables to `CHDChain` which track the highest known index. `TopUp` is modified to always try to top up the inactive HD chains, and this process will use the new variables to determine how much to top up. In this way, after an encrypted wallet is unlocked, the inactive HD chains will be topped up and hopefully funds will not be missed.

  Note that because these variables are not persisted to disk (because `CHDChain`s for inactive HD chains are not written to disk), if an encrypted wallet is not unlocked in the same session as a key from an inactive chain is found to be used, then it will not be topped up later unless more keys are found.

  Additionally, wallets which do not have upgraded key metadata will not derive any keys from inactive HD chains. This is resolved by using the derivation path string in `CKeyMetadata.hdKeypath` to determine what indexes to derive.

ACKs for top commit:
  laanwj:
    Code review ACK c4d76c6faa

Tree-SHA512: b2b572ad7f1b1b2847edece09f7583543d63997e18ae32764e5a27ad608dd64b9bdb2d84ea27137894e986a8e82f047a3dba9c8015b74f5f179961911f0c4095
2022-03-02 09:35:07 +01:00
Andrew Chow
c4d76c6faa tests: Tests for inactive HD chains
test cases are added for inactive HD chains: a basic case, a case
where the wallet is encrypted, and a case for the 21605 segfault.
2022-02-22 14:41:52 -05:00
laanwj
b223c3c21e test: Add functional test for symlinked blocks directory 2022-02-17 12:33:30 +01:00
Martin Zumsande
a036358994 test: Repair failfast option for test runner 2022-01-28 15:46:51 +01:00
MarcoFalke
dd405add6e
Merge bitcoin/bitcoin#24154: test: add functional test for -maxtipage parameter
75656adfd2 test: add functional test for `-maxtipage` parameter (Sebastian Falbesoner)

Pull request description:

  This PR adds a missing test for the `-maxtipage` parameter which controls what is the allowed maximum tip age for leaving IBD:
  792d0d8d51/src/init.cpp (L540)

  Relevant code path in the `CChainState::IsInitialBlockDownload` method:
  792d0d8d51/src/validation.cpp (L1479-L1480)

  The test is pretty simple and should be self-explanatory.

ACKs for top commit:
  MarcoFalke:
    review ACK 75656adfd2

Tree-SHA512: 0a10dca13cb18c29e64fc8412f4c8f2bcaff1bab8645bd85266c242ba88ce036a150c03cbbe9810c3bb44649810af0aa9cb3584dbae886a7bdb16b72150d08de
2022-01-26 07:36:07 +01:00