SomberNight
73e2b09ba8
blockchain: check best chain on disk is consistent with checkpoints
...
had a corrupted mainnet datadir that had testnet blockchain_headers file
(I had probably corrupted it myself but electrum could not recover from it)
7 years ago
SomberNight
bddea809ec
storage/blockchain: use os.replace
7 years ago
SomberNight
d7c5949365
prefer int.from_bytes over int('0x'+hex, 16)
7 years ago
SomberNight
65ce3deeaa
blockchain: chain hierarchy based on most work, not length
7 years ago
SomberNight
141ff99580
blockchain.py: generalise fork ids to get rid of conflicts
7 years ago
SomberNight
a8e6eaa247
blockchain: fix difficulty retarget
...
"target" is a 256 bit int, but the "bits" field in the block headers
that is used to represent target is only 32 bits.
We were checking PoW against the untruncated target value, which is a
slightly larger value than the one that can actually be represented,
and hence we would have accepted a slightly lower difficulty chain
than what the consensus requires.
7 years ago
SomberNight
e37da62a1c
fix most "scripts"
...
related: #4754
7 years ago
SomberNight
082a83dd85
rename crypto.Hash to sha256d
7 years ago
SomberNight
81cc20039e
more type annotations in core lib
7 years ago
SomberNight
37206ec08e
network: auto-switch servers to preferred fork (or longest chain)
...
If auto_connect is enabled, allow jumping between forks too.
(Previously auto_connect was only switching servers on a given fork,
not across forks)
If there is a preferred fork set, jump to that (and stay);
if there isn't, always jump to the longest fork.
7 years ago
SomberNight
4360a785ad
blockchain: blockchains_lock needed to write/iterate global dict
7 years ago
SomberNight
1635bc8cb3
blockchain: use HEADER_SIZE named constant instead of magic numbers
7 years ago
SomberNight
8cd08cc0fa
network: rm dead code; simplify
7 years ago
SomberNight
a5b3f809ce
blockchain.py: add type annotations
7 years ago
SomberNight
cdca74aa39
move max_checkpoint from network to constants
7 years ago
SomberNight
3f0d79f07d
blockchain.py: better handling of missing headers. more restrictive verify_chunk.
7 years ago
Janus
e9ceeb85af
async block headers
7 years ago
SomberNight
2a9f5db576
blockchain.py: fix: chunks in checkpoint region were not getting saved if we were on a fork
7 years ago
SomberNight
531cdeffa9
blockchain.py: rename 'checkpoint' to 'forkpoint'
7 years ago
SomberNight
b44aca1654
network: disconnect from server on incorrect header length
...
fix #4522
8 years ago
Janus
097ac144d9
file reorganization with top-level module
8 years ago
Francisco J. Hernandez Heras
469565c188
Improving imports ( #4448 )
8 years ago
SomberNight
219c2a363a
fix #4401
8 years ago
ghost43
9b7a449057
util.make_dir: 0o700 permissions on folders ( #4357 )
8 years ago
SomberNight
c8bed8791a
assert datadir available
8 years ago
SomberNight
7b50790584
do not raise BaseException
8 years ago
SomberNight
0180abc179
blockchain.py: check header length
...
related: #4212
8 years ago
SomberNight
ec33463426
fix #4184
8 years ago
SomberNight
5fef1e7980
close #4125
...
perhaps not proper fix but at least more descriptive exception text
8 years ago
SomberNight
81b6d65764
refactor network constants
8 years ago
SomberNight
151aa9d135
fix prev; offset is relative to last forking height
8 years ago
SomberNight
02c7524d75
logging: some extra network-related lines
8 years ago
ThomasV
0928ac961a
fix #3955 : fix interference between verifier and catch_up
8 years ago
ThomasV
c8e67e2bd0
fix #3635
8 years ago
pooler
8bcefe6cfa
Fix Blockchain.get_target()
8 years ago
ThomasV
de01008992
blockchain: do not load forks that cannot connect to the main headers file
8 years ago
ThomasV
44a83c2401
read checkpoints file in NetworkConstants, add it to setup.py
8 years ago
ThomasV
d1b8a6fae6
Replace initial headers download with hardcoded checkpoints
8 years ago
SomberNight
c65d01ea96
file i/o: use 'with' keyword
8 years ago
SomberNight
0db5ea67a0
bitcoin.NetworkConstants: easier changing between testnet and mainnet
8 years ago
ThomasV
ab15ff3a00
updates for python3
8 years ago
ThomasV
bc591377e8
python3: fix integer division
8 years ago
Dmitry Sorokin
f02d18226b
misc ui and lib fixes for py3
8 years ago
Dmitry Sorokin
5be78950ca
py3
8 years ago
ThomasV
5872bd4722
force new headers download if file is corrupted
8 years ago
ThomasV
882e259a78
sanity check read_header
8 years ago
ThomasV
94f7a87e47
remove dead code
9 years ago
ThomasV
810f107229
follow-up commit 5f3e5866ad
9 years ago
ThomasV
5f3e5866ad
blockchain write method, that flushes file
9 years ago
ThomasV
d71c9d5be3
make blockchain.size() threadsafe
9 years ago