From c4942dd7166b3741bc9400ebac6823d56896f707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20F=C3=BCrderer?= Date: Sun, 25 Feb 2024 00:55:47 +0100 Subject: [PATCH] Send the second last block difficulty sum This counters a possible attack where a miner could try to replace an already mined block with a different one that appears to be mined just one second before. --- docs/blockchain.md | 2 +- docs/protocol-v0.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/blockchain.md b/docs/blockchain.md index b68d99d..4d25c35 100644 --- a/docs/blockchain.md +++ b/docs/blockchain.md @@ -74,7 +74,7 @@ block_difficulty = max(calculated_difficulty, 2^28) Note the max() operation: A difficulty can never be lower than 2^28 (=268435456). This is a strict lower bound. -For the first block, the "difficulty sum" value is set to 2^28. +For the first block, the "difficulty sum" value is set to 2^29. Early in the chain, when less than 11 blocks have been mined, we make assumptions for blocks "before" the first block: - Each of these "before" blocks had a block difficulty of exactly 2^28 diff --git a/docs/protocol-v0.md b/docs/protocol-v0.md index c888255..d8ea711 100644 --- a/docs/protocol-v0.md +++ b/docs/protocol-v0.md @@ -77,11 +77,11 @@ If the list contains less than 1024 entries, set "transaction fee", "sender pubk | protocol version = 0 (BE) | 2 | | capable version = 0 (BE) | 2 | | type = 0 (BE) | 1 | -| difficulty sum of last known block (BE) | 32 | +| difficulty sum of second last known block (BE) | 32 | | hash value of open transaction # 1023 | 32 | | partner IPv6 | 16 | | partner port (BE) | 2 | -The difficulty sum is sent as 0 if no block is known. +The difficulty sum is sent as 2^28 if only one block is known or as 0 if no block is known. partner IPv6 and partner port may be nullbytes (no partner included).