Use void* throughout support/lockedpool.h
Replace uses of char* with void* in Arena's member variables. Instead, cast to char* where needed in the implementation. Certain compiler environments disallow std::hash<char*> specializations to prevent hashing the pointer's value instead of the string contents. Thus, compilation fails when std::unordered_map is keyed by char*. Explicitly using void* is a workaround in such environments. For consistency, void* is used throughout all member variables similarly to the public interface.
doc: minor improvements in getutxos REST endpoint synopsis
Describing an optional sub-path as <checkmempool> in the synopsis could be misleading as the angle brackets normally indicate that the field has to be replaced a custom value. Clarify that by showing two variants instead, similar to the block endpoint with the notxdetails option. Further improvements: - uppercase <TXID> and <N>, to match the description of the other endpoints - s/getutxo command/getutxos endpoint/ - describe what the checkmempool option does - s/serialisation/serialization/ (the US spelling is more dominant than the UK spelling in the project, and there is indeed no other instance of the string "serialis*" in the source tree, except once in a release note) - link to BIP64 within the text instead of only showing bare URL - mention that BIP64 is only relevant for bin and hex output formats - show two endpoint formats of the block section as list
Ignore problematic blocks in DisconnectBlock
When using checklevel=4, block verification fails because of duplicate coinbase transactions involving blocks 91812 and 91722. There was already a check in place for ConnectBlock to ignore the problematic blocks, but DisconnectBlock did not contain a similar check. This change ignores the blocks where these inconsistencies surface so that block verification will succeed at checklevel=4.
init: limit bip30 exceptions to coinbase txs
Co-authored-by: James O'Beirne <james.obeirne@pm.me>
fees: make the class FeeFilterRounder thread-safe
So that its methods can be called concurrently by different threads on the same object. Currently it has just one method (`round()`). Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
fees: make FeeFilterRounder::feeset const
It is only set in the constructor, thus improve readability by marking it as `const` and setting it from the initializer list using a helper function to derive its value. The idea was suggested by Anthony Towns <aj@erisian.com.au> in bitcoin#19268 (comment)
style: rename variables to match coding style
Rename the variables that were touched by the previous commit (split logical from style changes). minIncrementalFee -> min_incremental_fee minFeeLimit -> min_fee_limit bucketBoundary -> bucket_boundary feeset -> fee_set FeeFilterRounder::feeset -> FeeFilterRounder::m_fee_set
Specifically this enables the Send button in the fee bump dialog for wallets with external signer support. Similar to 2efdfb8.
reindex, log, test: fixes bitcoin#21379
This fixes a blk file size calculation made during reindex that results in increased blk file malformity. The fix is to avoid double counting the size of the serialization header during reindex. This adds a unit test to reproduce the bug before the fix and to ensure that it does not recur. These changes include a log message change also so as to not be as alarming. This is a common and recoverable data corruption. These messages can now be filtered by the debug log reindex category.
rpc: Pruned nodes can not fetch unsynced blocks
While a node is still catching up to the tip that it is aware of via the headers, the user can currently use to fetch blocks close to the tip. These blocks are stored in the current block/rev file which otherwise contains blocks the node is receiving as part of the syncing process. This creates a problem for pruned nodes: The files containing a fetched block are not pruned during syncing because they contain a block close to the tip. This means the entire file will not be pruned until the tip have moved on far enough from the fetched block. In extreme cases with heavy pruning (550) and multiple blocks being fetched this could mean that the disc usage far exceeds what the user expects, potentially running out of space.
build: Specify native binaries explicitly when building capnp package
From `configure --help`:
--with-external-capnp use the system capnp binary (or the one specified
with $CAPNP) instead of compiling a new one (useful
for cross-compiling)moveonly: move IsSelectableSocket() from compat.h to sock.{h,cpp}
To be converted to a method of the `Sock` class.
net: convert standalone IsSelectableSocket() to Sock::IsSelectable()
This makes the callers mockable.
moveonly: move SetSocketNonBlocking() from netbase to util/sock
To be converted to a method of the `Sock` class.
net: convert standalone SetSocketNonBlocking() to Sock::SetNonBlocking()
This further encapsulates syscalls inside the `Sock` class. Co-authored-by: practicalswift <practicalswift@users.noreply.github.com>
refactor: Add LIFETIMEBOUND / -Wdangling-gsl to Assert()
wallet: avoid double TopUp() calls on descriptor wallets
Move TopUp() responsibility from the wallet class to each scriptpubkeyman. So each spkm can decide to call it or not after perform the basic checks for the new destination request. Reason: We were calling it twice in the following flows for descriptor wallets: A) CWallet::GetNewDestination: 1) Calls spk_man->TopUp() 2) Calls spk_man->GetNewDestination() --> which, after the basic script checks, calls TopUp() again. B) CWallet::GetReservedDestination: 1) Calls spk_man->TopUp() 2) Calls spk_man->GetReservedDestination() --> which calls to GetNewDestination (which calls to TopUp again).
gui: Show watchonly balance only for Legacy wallets
Descriptor wallets do not have a watchonly balance as wallets are designated watchonly or not. Thus we should not be displaying the empty watchonly balance for descriptor wallets.
net: remove useless call to IsReachable() from CConnman::Bind()
`CConnman::Bind()` is called without `BF_EXPLICIT` only when passed either `0.0.0.0` or `::`. For those addresses `IsReachable()` is always true (regardless of the `-onlynet=` setting!), meaning that the `if` condition never evaluates to true. `IsReachable()` is always true for the "any" IPv4 and IPv6 addresses because `CNetAddr::GetNetwork()` returns `NET_UNROUTABLE` instead of `NET_IPV4` or `NET_IPV6` and the network `NET_UNROUTABLE` is always considered reachable. It follows that `BF_EXPLICIT` is unnecessary, remove it too.
depends: libnatpmp 07004b97cf691774efebe70404cf22201e4d330d
This pulls in two changes I've upstreamed: Support for pkg-config: miniupnp/libnatpmp#19 Suppressing a deprecation warning: miniupnp/libnatpmp#28 Somewhat related to bitcoin#22644.
univalue: Avoid std::string copies
util: improve bitcoin-wallet exit codes
build: fix depends bdb compilation for BSDs
Currently, building bdb for *BSD HOSTs in depends fails with:
```bash
libtool: compile: clang -m64 -c -I. -I../dist/./.. -I/home/ubuntu/bitcoin/depends/x86_64-unknown-freebsd/include -D_THREAD_SAFE -pipe -std=c11 -O2 -Wno-error=implicit-function-declaration -Wno-error=format-security ../dist/./../mutex/mut_tas.c -fPIC -DPIC -o mut_tas.o
In file included from ../dist/./../mutex/mut_tas.c:11:
In file included from ./db_int.h:884:
In file included from ../dist/./../dbinc/mutex.h:15:
../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t'
MUTEX_FIELDS /* Opaque thread mutex structures. */
^
../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS'
pthread_rwlock_t rwlock; /* Read/write lock */ \
^
1 error generated.
```
Defining `_XOPEN_SOURCE` >=600 fixes access to the missing
`pthread_rwlock_t` definitions.rpc: Set RPCArg options with designated initializers