Commit graph

1008 commits

Author SHA1 Message Date
Andrew Poelstra
7447a3b352 Merge d8ae29ec8f into merged_master (Bitcoin PR bitcoin/bitcoin#21900) 2021-07-08 18:04:18 +00:00
Andrew Poelstra
ab1e80eb09 Merge 779aaa7f03 into merged_master (Bitcoin PR bitcoin/bitcoin#21754)
What a pain in the ass. This changes the `feature_cltv` functional test
to use the `MiniWallet`, an internal Pythonic wallet that produces
"signatures" consisting of several OP_NOPs in a row, so that this test
can be used when the wallet is disabled.

This means that the functions in feature_cltv which add a CLTV check and
change the locktime/sequence number no longer need to re-sign when they
change the txid, so they don't...HOWEVER, our Elements-specific
`feature_block_v4` test calls these functions with a real transaction
and depended on the re-signing behavior.

After several attempts at min-effort min-diff fixes I landed on this,
which simply sets the locktime at transaction creation and avoids having
to re-sign at all.

Also, I had to change the number of NOPs in the fake wallet code to make
a vsize assertion pass, presumably because of differences in Bitcoin/Elements
transaction serialization.
2021-07-06 13:53:02 +00:00
Andrew Poelstra
c4182106af Merge 2b45cf0bcd into merged_master (Bitcoin PR bitcoin/bitcoin#19521)
This is part of the "UTXO Set Statistics" project in Core, which aims
to make things like "checking coin supply" faster. This stuff, and
related things in coinstats.cpp, have always been broken for Elements
in the sense that we consider only explicit outputs and we ignore
assets (so everything just gets added together to get a meaningless
total). It probably wouldn't be too hard to restrict this to only
consider policyAsset, but it's out of scope for a rebase IMO.

Also, I think this situation is fine .. I don't understand the motivation
for this or why Core is merging this when they refuse to merge an address
index .. but I guess we'll see if there are users who care about this data
and who care about it being meaningful on Elements.

Also, apologies for the big diff -- there were some mechanical changes
to deal with CT amounts, but most of the changes related to the difference
in how fees are accounted for. While I'm not thrilled with this PR, its
functional test is really good! So I think what I eventually came up with
is internally consistent.
2021-07-04 19:51:38 +00:00
Andrew Poelstra
4485d3c785 Merge 40310f5e8c into merged_master (Bitcoin PR bitcoin/bitcoin#21792) 2021-07-03 22:18:16 +00:00
Andrew Poelstra
6b565b9878 Merge fb66dbe786 into merged_master (Bitcoin PR bitcoin/bitcoin#21762) 2021-07-03 13:46:53 +00:00
Andrew Poelstra
a02abbc35a Merge 7f37a1d560 into merged_master (Bitcoin PR bitcoin/bitcoin#21785) 2021-07-03 08:56:11 +00:00
Andrew Poelstra
b945a1dacf Merge a1f0b8b62e into merged_master (Bitcoin PR #21634) 2021-06-30 12:41:09 +00:00
Andrew Poelstra
d39d57c704 Merge 1c7be9ab90 into merged_master (Bitcoin PR #20286)
I hate this PR.
2021-06-28 21:30:17 +00:00
Andrew Poelstra
d976552b1c Merge 9b48b3ac42 into merged_master (Bitcoin PR #21390)
Diff reduction :) again just had to replace some fixed hashes
2021-06-28 15:54:24 +00:00
Andrew Poelstra
c1cf0e6fa4 Merge ed49203daa into merged_master (Bitcoin PR #21357) 2021-06-28 13:58:19 +00:00
Andrew Poelstra
d44ce3a73f Merge 8ec881d3b6 into merged_master (Bitcoin PR #20861) 2021-06-27 19:12:42 +00:00
Andrew Poelstra
90f1f6650b Merge fbf5d16238 into merged_master (Bitcoin PR #21246) 2021-06-26 01:58:32 +00:00
Andrew Poelstra
ac89deaff7 Merge c0e44ee8e4 into merged_master (Bitcoin PR #21254) 2021-06-25 15:52:53 +00:00
Andrew Poelstra
e99a9c186a Merge 2059d32edb into merged_master (Bitcoin PR #21200) 2021-06-25 13:13:25 +00:00
Andrew Poelstra
578ee6183f Merge a9335e4f12 into merged_master (Bitcoin PR #16546)
There are a few layers of bullshit to this PR.

First, there is the fact that it adds a functional test gated on a new
config flag which is disabled by default, so it actually adds broken
code with no tests, waiting to ruin your day 520 PRs later when #21935
enables the broken test.

Second, the test appears to be superficially nonsensical because it
generates two transactions from different wallets and tries to compare
them for byte-for-byte equality, which doesn't make sense (at least)
because change outputs are randomly located...so something fishy is
going on.

Of course, in Elements the transactions are *not* equal half the time
because the outputs are permuted, which may have let me quickly figure
out the issue, except...

Third, there is a red herring of a bug where the two transactions have
slightly different feerates. This turns out to be caused by
CWallet::CalculateMaximumSignedTxSize using differently sized dummy
transactions depending on whether watchonly outputs are included (this
fact is conveniently disguised by #17211 slightly changing this logic;
this is an unmerged PR in Core that Elements has a backport of an old
version of). And the two wallets have different watchonly settings.

A sub-red-herring is the fact that this bug results in a discrepancy
of 0.25 vbytes, so it does not appear in Core but does appear in
Elements (there is a 3/16 probability that we should be so unlucky...
we are).

But this is all irrelevant, because...

Fourth, this test is actually super bullshit. The way it works is by
constructing a PSBT legitimately, saving this to disk, then re-"signs"
using the external signer interface by using a mock signer that
COMPLETELY REPLACES THE TRANSACTION UNDER CONSTRUCTION. So it doesn't
matter what the fee output looks like and it doesn't matter what the
order of the outputs. Core does not detect this malfeasance and
neither does Elements. For some reason, Core has a functional test
that explicitly checks that you can do this even though it is insane
and it is hard to think of non-malicious reasons to do it.

Fifth, while Elements fails to detect that its external signer is
actually changing the transaction out from under it, it DOES assume
that this won't happen. In CWallet::SignPSBT it blithely un-replaces
the transaction, which undermines the functional test.

Sixth, the original PR where this test was introduced has comments
locked, so anyone who spent six hours reverse-engineering this idiotic
broken test, and is still feeling charitable enough to discuss it with
the Core developors, can go pound sand.

Anyway, just disabled the broken test and move on with our lives.
2021-07-27 00:19:01 +00:00
Andrew Poelstra
37c94c9100 Merge b805dbb0b9 into merged_master (Bitcoin PR #19809) 2021-06-24 13:52:54 +00:00
Andrew Poelstra
2cec742519 Merge 860f916803 into merged_master (Bitcoin PR #20524) 2021-06-24 13:40:22 +00:00
Andrew Poelstra
1c42ada28c Merge 69f7f50aa5 into merged_master (Bitcoin PR #20993) 2021-06-24 00:14:00 +00:00
Andrew Poelstra
59b1a731c8 Merge 8d6994f93d into merged_master (Bitcoin PR #21100) 2021-06-23 13:41:16 +00:00
Andrew Poelstra
50a0a6246b Merge d48f9e8ebb into merged_master (Bitcoin PR #21124) 2021-06-21 14:32:43 +00:00
Andrew Poelstra
323f9bf6cd Merge b401b09355 into merged_master (Bitcoin PR #21107) 2021-06-21 08:23:27 +00:00
Andrew Poelstra
bcd5f2207c Merge a6b1bf6439 into merged_master (Bitcoin PR #20267) 2021-06-21 02:52:43 +00:00
Andrew Poelstra
81622629c1 Merge 384e090f93 into merged_master (Bitcoin PR #19509) 2021-06-20 20:00:04 +00:00
Andrew Poelstra
4fc9d12dc4 Merge 4c55f92c76 into merged_master (Bitcoin PR #20954) 2021-06-20 02:12:30 +00:00
Andrew Poelstra
a9ab76769e Merge 11cbd4bb54 into merged_master (Bitcoin PR #17556)
This PR eliminates "strange regtest=0 behavior" in a test which had forced
us to disable the test for Elements. Can re-enable now :)

I also removed the `chain_in_args` parameter to `TestNode`, which Steven added
in https://github.com/ElementsProject/elements/pull/533 (which itself replaces
unconditionally adding chain={} on the command-line, which was added in #458).
These were added in the 0.17 rebase to deal with the job of starting bitcoind,
which then did not support the `chain=` command-line arg as well as elementsd,
which back then required this command-line arg.

This was causing some issues with the "check -acceptnonstdtxn doesn't work on
mainnet" test because it would add -chain=elementsregtest to the command-line
of a daemon that was supposed to be connecting to mainnet/liquidv1. It is
possible to override this behavior, but since 0.20+ versions of elementsd and
bitcoind have essentially the same support for chain= options, it seemed
cleaner to just eliminate the diff.
2021-06-18 14:40:09 +00:00
Andrew Poelstra
6e0871df92 Merge 32e59fc371 into merged_master (Bitcoin PR #20916) 2021-06-17 23:00:15 +00:00
Andrew Poelstra
89f673c0bd Merge 6af013792f into merged_master (Bitcoin PR #19315)
This uses a regtest-only RPC which checks that the chain is literally
"regtest". Since regtest is disabled in Elements (we use elementsregtest)
I weakened the check for this to just check that the chain name has
"regtest" somewhere in it. Hopefully this isn't too magical.
2021-06-17 17:31:47 +00:00
Andrew Poelstra
c3a8653b11 Merge 9c0b76c709 into merged_master (Bitcoin PR #20876) 2021-06-17 15:30:21 +00:00
Andrew Poelstra
c5a022192f Merge d7e2401c62 into merged_master (Bitcoin PR #18077) 2021-06-17 01:59:15 +00:00
Andrew Poelstra
6afa119596 Merge b6a71b80d2 into merged_master (Bitcoin PR #19055) 2021-06-16 22:36:48 +00:00
Andrew Poelstra
617905a928 Merge 34322b7f5c into merged_master (Bitcoin PR #20842) 2021-06-16 18:28:04 +00:00
Andrew Poelstra
27930edc9c Merge 4a540683ec into merged_master (Bitcoin PR #20813) 2021-06-16 14:11:07 +00:00
Andrew Poelstra
691fc96215 Merge 0e1b57b4bb into merged_master (Bitcoin PR #20763) 2021-06-16 03:40:29 +00:00
Andrew Poelstra
9a27a41c59 Merge cc592a85ea into merged_master (Bitcoin PR #20189) 2021-06-15 23:48:08 +00:00
Andrew Poelstra
df6ba0e0c8 Merge cc2a5ef9b2 into merged_master (Bitcoin PR #20683) 2021-06-15 20:51:02 +00:00
Andrew Poelstra
26d6840001 Merge 5b6f970e3f into merged_master (Bitcoin PR #20171) 2021-06-14 19:26:23 +00:00
Andrew Poelstra
1e30b57d06 Merge da957cd62e into merged_master (Bitcoin PR #20613) 2021-06-14 00:07:04 +00:00
Andrew Poelstra
a9503e8d53 Merge 42ed7f51fa into merged_master (Bitcoin PR #20606) 2021-06-13 17:11:52 +00:00
Andrew Poelstra
49c7d30f1d Merge 90ef622ab5 into merged_master (Bitcoin PR #20564) 2021-06-11 19:27:33 +00:00
Andrew Poelstra
2d31b7300e Merge f17e8ba3a1 into merged_master (Bitcoin PR #20207) 2021-06-10 20:35:12 +00:00
Sebastian Falbesoner
2eca46b0aa test: use MiniWallet for feature_csv_activation.py
This test can now be run even with the Bitcoin Core wallet disabled.
2021-05-10 01:31:27 +02:00
Andrew Poelstra
4240c083aa Merge 7ae86b3c68 into merged_master (Bitcoin PR #20522) 2021-05-08 00:06:07 +00:00
Andrew Poelstra
a9e2850a58 Merge 2ee954daae into merged_master (Bitcoin PR #20458) 2021-05-07 18:18:43 +00:00
Andrew Poelstra
00e18636bf Merge 04670ef81e into merged_master (Bitcoin PR #20385) 2021-05-06 21:53:52 +00:00
MarcoFalke
779aaa7f03
Merge bitcoin/bitcoin#21754: test: Run feature_cltv with MiniWallet
fa066f1b66 test: Run feature_cltv with MiniWallet (MarcoFalke)
fa5591d38c test: Hide tx rehash in helper (MarcoFalke)
fa5f938cfe test: Remove new_tx reference (MarcoFalke)

Pull request description:

  Allows to run the test even with no wallet compiled in

ACKs for top commit:
  theStack:
    ACK fa066f1b66 💽

Tree-SHA512: 3f659a178ba3ee0baffd70fddf8b8a68e5551d85626c7f254b234d7f75e6a16430a32a7952037db358b579f045b4d296b46156f72e5d226f3e80334dc635ca10
2021-05-05 08:47:28 +02:00
W. J. van der Laan
2b45cf0bcd
Merge bitcoin/bitcoin#19521: Coinstats Index
5f96d7d22d rpc: gettxoutsetinfo rejects hash_serialized_2 for specific height (Fabian Jahr)
23fe50436b test: Add test for coinstatsindex behavior in reorgs (Fabian Jahr)
90c966b0f3 rpc: Allow gettxoutsetinfo and getblockstats for stale blocks (Fabian Jahr)
b9362392ae index, rpc: Add use_index option for gettxoutsetinfo (Fabian Jahr)
bb7788b121 test: Test coinstatsindex robustness across restarts (Fabian Jahr)
e0938c2909 test: Add tests for block_info in gettxoutsetinfo (Fabian Jahr)
2501576ecc rpc, index: Add verbose amounts tracking to Coinstats index (Fabian Jahr)
655d929836 test: add coinstatsindex getindexinfo coverage, improve current tests (Jon Atack)
ca01bb8d68 rpc: Add Coinstats index to getindexinfo (Fabian Jahr)
57a026c30f test: Add unit test for Coinstats index (Fabian Jahr)
6a4c0c09ab test: Add functional test for Coinstats index (Fabian Jahr)
3f166ecc12 rpc: gettxoutsetinfo can be requested for specific blockheights (Fabian Jahr)
3c914d58ff index: Coinstats index can be activated with command line flag (Fabian Jahr)
dd58a4de21 index: Add Coinstats index (Fabian Jahr)
a8a46c4b3c refactor: Simplify ApplyStats and ApplyHash (Fabian Jahr)
9c8a265fd2 refactor: Pass hash_type to CoinsStats in stats object (Fabian Jahr)
2e2648a902 crypto: Make MuHash Remove method efficient (Fabian Jahr)

Pull request description:

  This is part of the coinstats index project tracked in #18000

  While the review of the new UTXO set hash algorithm (MuHash) takes longer recently #19328 was merged which added the possibility to run `gettxoutsetinfo` with a specific hash type. As the first type it added `hash_type=none` which skips the hashing of the UTXO set altogether. This alone did not make `gettxoutsetinfo` much faster but it allows the use of an index for the remaining coin statistics even before a new hashing algorithm has been added. Credit to Sjors for the idea to take this intermediate step.

  Features summary:
  - Users can start their node with the option `-coinstatsindex` which syncs the index in the background
  - After the index is synced the user can  use `gettxoutsetinfo` with `hash_type=none` or `hash_type=muhash` and will get the response instantly out of the index
  - The user can specify a height or block hash when calling `gettxoutsetinfo` to see coin statistics at a specific block height

ACKs for top commit:
  Sjors:
    re-tACK 5f96d7d22d
  jonatack:
    Code review re-ACK 5f96d7d22d per `git range-diff 13d27b4 07201d3 5f96d7d`
  promag:
    Tested ACK 5f96d7d22d. Light code review ACK 5f96d7d22d.

Tree-SHA512: cbca78bee8e9605c19da4fbcd184625fb280200718396c694a56c7daab6f44ad23ca9fb5456d09f245d8b8d9659fdc2b3f3ce5e953c1c6cf4003dbc74c0463c2
2021-04-30 17:27:19 +02:00
MarcoFalke
fad6269916
test: Assert that exit code indicates failure 2021-04-29 13:03:12 +02:00
MarcoFalke
fa066f1b66
test: Run feature_cltv with MiniWallet 2021-04-29 07:18:28 +02:00
MarcoFalke
fb66dbe786
Merge bitcoin/bitcoin#21762: test: Speed up mempool_spend_coinbase.py
fa40eb5b6b test: Speed up mempool_spend_coinbase.py (MarcoFalke)
fa29382ab2 test: Fix test cache issue (MarcoFalke)
fa085b470a test: Create MiniWallet.create_self_transfer (MarcoFalke)
fa1bedb494 test: Add MiniWallet.sendrawtransaction (MarcoFalke)

Pull request description:

  Locally the test will run 4 seconds faster with `--valgrind` (18s vs 14s)

ACKs for top commit:
  mjdietzx:
    crACK https://github.com/bitcoin/bitcoin/pull/21762/commits/fa40eb5b6bfd151912c58d61771f6a6528f44e67

Tree-SHA512: ecfb60dda5ca5d7e6367bb9c6210390d95ebf6396ce657728901d118b75bb90c98f9351df3b01004d00682234448d6c6a13338d12097f7dced2cf7f1bd84d924
2021-04-29 07:13:49 +02:00
MarcoFalke
faa51ef4d3
test: Fix intermittent issue in p2p_addr_relay.py 2021-04-28 08:16:29 +02:00