1
0
Commit Graph

26 Commits

Author SHA1 Message Date
SomberNight
3385a94753 logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
bca6ad5241 verifier: fix logic bug. after reorg, some verifs were not undone
after a reorg, in a many fork/orphan chains scenario,
we would sometimes not undo SPV for enough blocks

functions in blockchain.py somewhat based on kyuupichan/bitcoinX@5126bd15ef
2019-03-26 21:01:43 +01:00
SomberNight
9a71120090 blockchain: fix bug when swapping chain with parent
chain might become the parent of some of its former siblings
2019-03-26 20:55:27 +01:00
ghost43
dc19cf1fa1 wallet: randomise locktime of transactions a bit. also check if stale. (#4967) 2019-01-16 18:51:59 +01:00
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)
2018-11-30 16:36:37 +01:00
SomberNight
bddea809ec storage/blockchain: use os.replace 2018-11-30 04:08:02 +01:00
ThomasV
d062548e41 Merge pull request #4861 from SomberNight/blockchain_fork_ids
blockchain: generalise fork handling and follow most work chain
2018-11-28 12:54:57 +01:00
SomberNight
d7c5949365 prefer int.from_bytes over int('0x'+hex, 16) 2018-11-26 01:16:26 +01:00
SomberNight
65ce3deeaa blockchain: chain hierarchy based on most work, not length 2018-11-22 17:13:43 +01:00
SomberNight
141ff99580 blockchain.py: generalise fork ids to get rid of conflicts 2018-11-22 16:57:22 +01:00
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.
2018-11-22 16:52:51 +01:00
SomberNight
e37da62a1c fix most "scripts"
related: #4754
2018-11-02 20:14:59 +01:00
SomberNight
082a83dd85 rename crypto.Hash to sha256d 2018-10-25 22:28:24 +02:00
SomberNight
81cc20039e more type annotations in core lib 2018-10-22 16:41:25 +02:00
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.
2018-10-11 20:07:19 +02:00
SomberNight
4360a785ad blockchain: blockchains_lock needed to write/iterate global dict 2018-09-16 18:26:40 +02:00
SomberNight
1635bc8cb3 blockchain: use HEADER_SIZE named constant instead of magic numbers 2018-09-16 03:06:21 +02:00
SomberNight
8cd08cc0fa network: rm dead code; simplify 2018-09-12 01:40:54 +02:00
SomberNight
a5b3f809ce blockchain.py: add type annotations 2018-09-11 22:14:57 +02:00
SomberNight
cdca74aa39 move max_checkpoint from network to constants 2018-09-09 05:00:09 +02:00
SomberNight
3f0d79f07d blockchain.py: better handling of missing headers. more restrictive verify_chunk. 2018-09-06 14:17:42 +02:00
Janus
e9ceeb85af async block headers 2018-09-06 14:17:41 +02:00
SomberNight
2a9f5db576 blockchain.py: fix: chunks in checkpoint region were not getting saved if we were on a fork 2018-08-03 19:06:23 +02:00
SomberNight
531cdeffa9 blockchain.py: rename 'checkpoint' to 'forkpoint' 2018-08-03 18:25:53 +02:00
SomberNight
b44aca1654 network: disconnect from server on incorrect header length
fix #4522
2018-07-13 18:11:48 +02:00
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00