Skip to content

Commit

Permalink
fold V1 description into V2
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Jul 31, 2024
1 parent 7383f1d commit 38d7d6c
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions core/src/main/java/org/bitcoinj/store/SPVBlockStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,28 +371,16 @@ public void close() throws BlockStoreException {
}

static final int RECORD_SIZE_V1 = 32 /* hash */ + StoredBlock.COMPACT_SERIALIZED_SIZE;

// V1 file format:
// 4 magic header bytes = "SPVB"
// 4 cursor bytes, which indicate the offset from the first kb where the next block header should be written.
// 32 bytes for the hash of the chain head
//
// For each header (128 bytes)
// 32 bytes hash of the header
// 12 bytes of chain work
// 4 bytes of height
// 80 bytes of block header data

static final int RECORD_SIZE_V2 = 32 /* hash */ + StoredBlock.COMPACT_SERIALIZED_SIZE_V2;

// V2 file format:
// 4 magic header bytes = "SPV2"
// V2 file format, V1 in parenthesis:
// 4 magic header bytes = "SPV2" ("SPVB" for V1)
// 4 cursor bytes, which indicate the offset from the first kb where the next block header should be written.
// 32 bytes for the hash of the chain head
//
// For each header (148 bytes)
// For each header:
// 32 bytes hash of the header
// 32 bytes of chain work
// 32 bytes of chain work (12 bytes for V1)
// 4 bytes of height
// 80 bytes of block header data

Expand Down

0 comments on commit 38d7d6c

Please sign in to comment.