The block files may be open when deleteFile is called. This resulted in
files not being deleted and erroring out on windows. Properly closing
the files closing the files avoids this error.
This change lets us test that we don't attempt to delete open files with
unit tests. On Windows this behavior is not allowed which results in an
error but on linux and osx it's allowed. To better test Windows
compatibilty adding this explicit check in is useful.
commit 0b2998b7f279d3aef4d83415dae26948f5a6bdf4
Author: cec489 <173723251+cec489@users.noreply.github.com>
Date: Mon Jun 24 20:01:13 2024 +0000
A cleaner fix is to set the startTime in the server Start() function
which is where the server is actually started.
commit ae6c1256981befb43972e83a086ea663df629873
Author: cec489 <173723251+cec489@users.noreply.github.com>
Date: Mon Jun 24 19:15:23 2024 +0000
Fix the btcctl uptime command by moving the setting of startupTime
Fixes#2199.
Previous to this fix the keytype was only interpreted as a single byte,
even though BIP-0174 states it is to be parsed as a CompactSize/VarInt.
ReconsiderBlock reconsiders the validity of the block for the passed
in blockhash. The behavior of the function mimics that of Bitcoin Core.
The invalid status of the block nodes are reset and if the chaintip that
is being reconsidered has more cumulative work, then we'll validate the
blocks and reorganize to it. If the cumulative work is lesser than the
current active chain tip, then nothing else will be done.
reorganizeChain() used to handle the following:
1: That the blocknodes being disconnected/connected indeed to connect
properly without errors.
2: Perform the actual disconnect/connect of the blocknodes.
The functionality of 1, the validation that the disconnects/connects can
happen without errors are now refactored out into
verifyReorganizationValidity.
This is an effort made so that ReconsiderBlock() can call
verifyReorganizationValidity and set the block status of the
reconsidered chain and return nil even when an error returns as it's ok
to get an error when reconsidering an invalid branch.
This is to mitigate CVE-2017-12842. Along the way, also error when
deserializing transactions that have the witness marker flag set
but have no witnesses. This matches Bitcoin Core's behaviour initially
introduced here https://github.com/bitcoin/bitcoin/pull/14039. Allowing
such transactions is benign, but this makes sure that our parsing code
matches Core's exactly.
This exposes publicly the ability to decode arbitrary-length bech32
strings and return the bech32 version that was used in the encoding. It
provides the underlying functionality for both DecodeNoLimit and
DecodeGeneric.
InvalidateBlock() invalidates a given block and marks all its
descendents as invalid as well. The active chain tip changes if the
invalidated block is part of the best chain.
* chaincfg: remove unresponsive dnsseed on testnet
testnet-seed.bitcoin.schildbach.de is unresponsive and doesn't return
any ips. Bitcoin Core has already removed it and we don't also be
getting rid of it as well.
* chaincfg: add dnsseeds from Sjors Provoost
His seeds work well and we don't have any for signet and it's good to
replace the lost dns seed on testnet.
* chaincfg: remove bad dnsseed (seed.bitcoinstats.com)
seed.bitcoinstats.com doesn't respect filter requests even though it's
advertised as it does. Plus it often returns nodes that are unreachable.
In my testing over the past week, it's been the most unreliable dns seed
and since we have plenty of mainnet seeds, it's better to do away with
this.
I documented my findings for this in a Bitcoin Core issue:
https://github.com/bitcoin/bitcoin/issues/29911
* chaincfg: add dnsseed from wiz
It's the same infrastructure that mempool . space runs on and has been
reliable. The same seed is also included in Bitcoin Core as well.
The block generating functions here allow for a test to create mock
blocks. This is useful for testing invalidateblock and reconsiderblock
methods on blockchain that will be added in later commits.
createSpendTx is moved to testhelper so that the function can be used
for callers in package blockchain without introducing import cycles.
The test code for invalidateblock and reconsiderblock that are going to
be added in later commits make use of this code.