Commit graph

26 commits

Author SHA1 Message Date
MarcoFalke
fae76393bd
test: Avoid F541 (f-string without any placeholders) 2024-12-05 08:39:09 +01:00
Fabian Jahr
72c9a1fe94
test: Check that network stays suspended after dumptxoutset if it was off before 2024-09-12 23:21:58 +02:00
Fabian Jahr
4b5bf335ad
test: Add coverage for failing dumptxoutset behavior
In case of a failure to create the dump, the node should not be left in an inconsistent state like deactivated network activity or an invalidated blockchain.
2024-09-05 10:30:34 +02:00
Fabian Jahr
8426850352
test: Test for dumptxoutset at specific height 2024-09-01 20:56:39 +02:00
Fabian Jahr
993cafe7e4
RPC: Add type parameter to dumptxoutset 2024-09-01 20:56:38 +02:00
Fabian Jahr
00618e8745
assumeutxo: Drop block height from metadata
The Snapshot format version is updated to 2 to indicate this change.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-08-08 23:55:06 +02:00
Hennadii Stepanov
a0473442d1
scripted-diff: Add __file__ argument to BitcoinTestFramework.init()
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py)
sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py
-END VERIFY SCRIPT-
2024-07-16 22:06:47 +01:00
Fabian Jahr
542e13b293
rpc: Enhance metadata of the dumptxoutset output
The following data is added:
- A newly introduced utxo set magic
- A version number
- The network magic
- The block height
2024-05-21 13:57:09 +02:00
Fabian Jahr
de95953d87
rpc: Optimize serialization disk space of dumptxoutset
Co-authored-by: Aurèle Oulès <aurele@oules.com>
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
2024-05-21 13:38:07 +02:00
Fabian Jahr
351370a1d2
coinstats: Fix hash_serialized2 calculation
The legacy serialization was vulnerable to maleation and is fixed by
adopting the same serialization procedure as was already in use for
MuHash.

This also includes necessary test fixes where the hash_serialized2 was
hardcoded as well as correction of the regtest chainparams.

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2023-10-20 22:53:05 +02:00
ns-xvrn
bfa0bd632a test: Use pathlib over os.path #28362
revert netutil chgs py3.8 compliant

fixes based on PR review
2023-10-10 09:26:56 -04:00
fanquake
2dea6c5ca0
Merge bitcoin/bitcoin#27572: test: dedup file hashing using sha256sum_file helper
2c0c6f4477 test: dedup file hashing using `sha256sum_file` helper (Sebastian Falbesoner)

Pull request description:

  Rather than doing the open/read/hash-steps manually in the affected functional tests, we can just use the `sha256sum_file` helper from the utils module instead.

  Note that for the tool_wallet.py test, the used hash is changed from sha1 to sha256, but as the only purpose is to detect file content changes, this doesn't matter. Also, the optimization using `memoryview` is overkill here, as the opened file has only a size of 24KiB and determining the hash via the helper doesn't take longer than a few hundred micro-seconds on my machine.

ACKs for top commit:
  kristapsk:
    ACK 2c0c6f4477

Tree-SHA512: 64fe21650b56a50e9f1a95f6ef27d88d8bfbb621e5be456f327ef8dbb5596b529d03976c200f3fd68da48cc427de9f257b403f3228e38cf1df918006674fac68
2023-08-02 11:53:35 +01:00
MarcoFalke
dddd89962b
test: Allow pathlib.Path as RPC argument via authproxy
Also, add datadir_path property to TestNode
2023-06-21 08:48:52 +02:00
Sebastian Falbesoner
2c0c6f4477 test: dedup file hashing using sha256sum_file helper
Rather than doing the open/read/hash-steps manually in the affected
functional tests, we can just use the `sha256sum_file` helper from the
utils module instead.

Note that for the tool_wallet.py test, the used hash is changed from
sha1 to sha256, but as the only purpose is to detect file content
changes, this doesn't matter. Also, the optimization using `memoryview`
is overkill here, as the opened file has only a size of 24KiB and
determining the hash doesn't take longer than a few hundred
micro-seconds on my machine.
2023-05-04 14:18:13 +02:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
Sebastian Falbesoner
9feb887082 rpc: check fopen return code in dumptxoutset
This change improves the usability of the `dumptxoutset` RPC in two ways,
in the case that an invalid path is passed:
  1. return from the RPC immediately, rather then when the file is first
     tried to be written (which is _after_ calculating the UTXO set hash)
  2. return a proper return code and error message instead of the cryptic
     "CAutoFile::operator<<: file handle is nullptr: unspecified
      iostream_category error" (-1)
2022-05-11 16:03:40 +02:00
MarcoFalke
fa38b1c8bd
Remove buggy and confusing IncrementExtraNonce 2022-04-01 11:00:42 +02:00
W. J. van der Laan
6acda4b00b
Merge bitcoin/bitcoin#23155: rpc: various fixups for dumptxoutset
ffd09281fe rpc: various fixups for dumptxoutset (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11) (parent PR: #15606)

  ---

  A few fixes to make this RPC actually useful when generating snapshots.

  - Generate an assumeutxo hash and display it (sort of a bugfix)
  - Add nchaintx to output (necessary for use in chainparams entry)
  - Add path of serialized UTXO file to output

ACKs for top commit:
  laanwj:
    Code review ACK ffd09281fe

Tree-SHA512: b0b5fd5138dea0e21258b1b18ab75bf3fd1628522cc1dbafa81af9cb9fa96562a1c39124fdb31057f256bfc560f462f907e9fe5e209b577b3f57afae2b7be826
2021-12-02 10:35:02 +01:00
James O'Beirne
ffd09281fe
rpc: various fixups for dumptxoutset
- Actually generate an assumeutxo hash and display it
- Add nchaintx to output (necessary for use in chainparams entry)
- Add path of serialized UTXO file to output
2021-11-30 11:19:26 -05:00
MarcoFalke
fac23c2114
scripted-diff: Bump copyright headers
The previous diff touched most files in ./test/, so bump the headers to
avoid having to touch them again for a bump later.

-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./test/
-END VERIFY SCRIPT-
2021-11-10 11:10:24 +01:00
MarcoFalke
fa0b916971
scripted-diff: Use generate* from TestFramework
-BEGIN VERIFY SCRIPT-
 sed --regexp-extended -i \
     's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \
     $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf')
-END VERIFY SCRIPT-
2021-09-02 10:34:35 +02:00
Kiminuo
bfa9309ad6 Use COINBASE_MATURITY constant in functional tests. 2021-05-31 07:32:28 +02:00
James O'Beirne
91d93aac4e
validation: remove nchaintx from assumeutxo metadata
This value is no longer used and is instead specified statically
in chainparams. This change means that previously generated
snapshots will no longer be usable.
2021-04-26 13:22:37 -04:00
MarcoFalke
fa488f131f
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-04-16 13:33:09 -04:00
Sebastian Falbesoner
eca56f8929 test: replace 'regtest' leftovers by self.chain
Commit 1abcecc40c replaced 'regtest' by self.chain
'regtest' "in almost all current tests", this commit takes care of the remaining
ones.
2020-02-05 04:28:40 +01:00
James O'Beirne
92b2f5306b test: add dumptxoutset RPC test 2019-11-05 13:36:04 -05:00