Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
624727f
merge bitcoin#24098: Use query parameters to control resource loading
kwvg Jul 28, 2025
53bfca8
merge bitcoin#26143: wait for the expected basic block filter index i…
kwvg Jul 28, 2025
2c6d522
merge bitcoin#24576: remove redundant base58 implementation
kwvg Jul 28, 2025
be86792
merge bitcoin#24739: Fix intermittent test failure in wallet_listrece…
kwvg Apr 1, 2022
68e4f98
merge bitcoin#25011: Do not always create a descriptor wallet in wall…
kwvg Apr 27, 2022
6f09738
merge bitcoin#25045: add coverage for invalid requests for `blockfilt…
kwvg Apr 30, 2022
e39b9d8
merge bitcoin#25106: check `fopen` return code
kwvg Jul 28, 2025
0b915e7
merge bitcoin#25213: fix crash at coinselection, add missing fee rate
kwvg May 25, 2022
fdba53e
merge bitcoin#25003: fix `coin_selection:aps_create_tx_internal` call…
kwvg Apr 27, 2022
b6b94b2
merge bitcoin#24629: Return the height of the actual last pruned block
kwvg Aug 2, 2025
f0975dc
merge bitcoin#24640: Correct description of getblockchaininfo's prune…
kwvg Mar 22, 2022
7b09514
merge bitcoin#24913: Add a benchmark for wallet loading
kwvg Apr 18, 2022
6c8a8f7
merge bitcoin#24924: Make WalletLoading benchmark run faster
kwvg Apr 19, 2022
528795d
merge bitcoin#25023: Remove unused SetTip(nullptr) code
kwvg Apr 29, 2022
83acd1d
merge bitcoin#25887: avoid unsetting service bits from `nLocalServices`
kwvg Aug 20, 2022
f55742b
merge bitcoin#25810: rename MAX_{ANCESTORS,DESCENDANTS} to DEFAULT_{A…
kwvg Jul 28, 2025
cccd71f
merge bitcoin#25792: add tests for `datacarrier` and `datacarriersize…
kwvg Aug 6, 2022
0f51413
fix: use properly formed hex encoding in `evo_assetlock`
kwvg Jul 30, 2025
b8c3535
merge bitcoin#25227: Handle invalid hex encoding in ParseHex
kwvg Feb 27, 2023
cc0e2d1
merge bitcoin#27218: Work around ParseHex gcc cross compiler bug
kwvg Mar 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/testgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Utilities to generate test vectors for the data-driven Dash tests.

Usage:

PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
115 changes: 0 additions & 115 deletions contrib/testgen/base58.py

This file was deleted.

40 changes: 19 additions & 21 deletions contrib/testgen/gen_key_io_test_vectors.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/usr/bin/env python3
# Copyright (c) 2012-2021 The Bitcoin Core developers
# Copyright (c) 2012-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Generate valid and invalid base58 address and private key test vectors.

Usage:
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
'''
# 2012 Wladimir J. van der Laan
# Released under MIT License
import os

from itertools import islice
from base58 import b58encode_chk, b58decode_chk, b58chars
import os
import random
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '../../test/functional'))

from test_framework.address import base58_to_byte, byte_to_base58, b58chars # noqa: E402
from test_framework.script import OP_DUP, OP_EQUAL, OP_EQUALVERIFY, OP_HASH160, OP_CHECKSIG # noqa: E402

# key types
PUBKEY_ADDRESS = 76
Expand All @@ -28,15 +32,6 @@
PRIVKEY_REGTEST = 239

# script
OP_0 = 0x00
OP_1 = 0x51
OP_2 = 0x52
OP_16 = 0x60
OP_DUP = 0x76
OP_EQUAL = 0x87
OP_EQUALVERIFY = 0x88
OP_HASH160 = 0xa9
OP_CHECKSIG = 0xac
pubkey_prefix = (OP_DUP, OP_HASH160, 20)
pubkey_suffix = (OP_EQUALVERIFY, OP_CHECKSIG)
script_prefix = (OP_HASH160, 20)
Expand Down Expand Up @@ -65,8 +60,10 @@ def is_valid(v):
'''Check vector v for validity'''
if len(set(v) - set(b58chars)) > 0:
return False
result = b58decode_chk(v)
if result is None:
try:
payload, version = base58_to_byte(v)
result = bytes([version]) + payload
except ValueError: # thrown if checksum doesn't match
return False
for template in templates:
prefix = bytearray(template[0])
Expand All @@ -83,7 +80,8 @@ def gen_valid_base58_vector(template):
suffix = bytearray(template[2])
dst_prefix = bytearray(template[4])
dst_suffix = bytearray(template[5])
rv = b58encode_chk(prefix + payload + suffix)
assert len(prefix) == 1
rv = byte_to_base58(payload + suffix, prefix[0])
return rv, dst_prefix + payload + dst_suffix

def gen_valid_vectors():
Expand Down Expand Up @@ -124,7 +122,8 @@ def gen_invalid_base58_vector(template):
else:
suffix = bytearray(template[2])

val = b58encode_chk(prefix + payload + suffix)
assert len(prefix) == 1
val = byte_to_base58(payload + suffix, prefix[0])
if random.randint(0,10)<1: # line corruption
if randbool(): # add random character to end
val += random.choice(b58chars)
Expand Down Expand Up @@ -152,7 +151,6 @@ def gen_invalid_vectors():
yield val,

if __name__ == '__main__':
import sys
import json
iters = {'valid':gen_valid_vectors, 'invalid':gen_invalid_vectors}
try:
Expand Down
10 changes: 8 additions & 2 deletions doc/REST-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,24 @@ The HTTP request and response are both handled entirely in-memory.
With the /notxdetails/ option JSON response will only contain the transaction hash instead of the complete transaction details. The option only affects the JSON response.

#### Blockheaders
`GET /rest/headers/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`
`GET /rest/headers/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`

Given a block hash: returns <COUNT> amount of blockheaders in upward direction.
Returns empty if the block doesn't exist or it isn't in the active chain.

*Deprecated (but not removed) since 23.0:*
`GET /rest/headers/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`

#### Blockfilter Headers
`GET /rest/blockfilterheaders/<FILTERTYPE>/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`
`GET /rest/blockfilterheaders/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`

Given a block hash: returns <COUNT> amount of blockfilter headers in upward
direction for the filter type <FILTERTYPE>.
Returns empty if the block doesn't exist or it isn't in the active chain.

*Deprecated (but not removed) since 23.0:*
`GET /rest/blockfilterheaders/<FILTERTYPE>/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`

#### Blockfilters
`GET /rest/blockfilter/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>`

Expand Down
20 changes: 20 additions & 0 deletions doc/release-notes-24098.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Notable changes
===============

Updated REST APIs
-----------------

- The `/headers/` and `/blockfilterheaders/` endpoints have been updated to use
a query parameter instead of path parameter to specify the result count. The
count parameter is now optional, and defaults to 5 for both endpoints. The old
endpoints are still functional, and have no documented behaviour change.

For `/headers`, use
`GET /rest/headers/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`
instead of
`GET /rest/headers/<COUNT>/<BLOCK-HASH>.<bin|hex|json>` (deprecated)

For `/blockfilterheaders/`, use
`GET /rest/blockfilterheaders/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`
instead of
`GET /rest/blockfilterheaders/<FILTERTYPE>/<COUNT>/<BLOCK-HASH>.<bin|hex|json>` (deprecated)
7 changes: 7 additions & 0 deletions doc/release-notes-24629.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Updated RPCs
------------

- The return value of the `pruneblockchain` method had an off-by-one bug,
returning the height of the block *after* the most recent pruned. This has
been corrected, and it now returns the height of the last pruned block as
documented.
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ BITCOIN_CORE_H = \
psbt.h \
random.h \
randomenv.h \
rest.h \
rpc/blockchain.h \
rpc/client.h \
rpc/evo_util.h \
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if ENABLE_WALLET
bench_bench_dash_SOURCES += bench/coin_selection.cpp
bench_bench_dash_SOURCES += bench/wallet_balance.cpp
bench_bench_dash_SOURCES += bench/wallet_create.cpp
bench_bench_dash_SOURCES += bench/wallet_loading.cpp
bench_bench_dash_LDADD += $(BDB_LIBS) $(SQLITE_LIBS)
endif

Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ BITCOIN_TESTS =\
test/getarg_tests.cpp \
test/governance_validators_tests.cpp \
test/hash_tests.cpp \
test/httpserver_tests.cpp \
test/i2p_tests.cpp \
test/interfaces_tests.cpp \
test/key_io_tests.cpp \
Expand Down Expand Up @@ -156,6 +157,7 @@ BITCOIN_TESTS =\
test/raii_event_tests.cpp \
test/random_tests.cpp \
test/ratecheck_tests.cpp \
test/rest_tests.cpp \
test/reverselock_tests.cpp \
test/rpc_tests.cpp \
test/sanity_tests.cpp \
Expand Down
Loading
Loading