Skip to content

Commit

Permalink
(squash) add comment about format of params
Browse files Browse the repository at this point in the history
  • Loading branch information
starius committed Feb 26, 2024
1 parent 557f7db commit 64e9332
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ void ParseSignetParams(const std::vector<uint8_t>& params, CChainParams::SigNetO
return;
}

// The format of params is extendable in case more fields are added in the future.
// It is encoded as a concatenation of (field_id, value) tuples, protobuf style.
// Currently there is only one field defined: pow_target_spacing, whose field_id
// is 0x01 and the lendth of encoding is 8 (int64_t). So valid values of params are:
// - empty string (checked in if block above),
// - 0x01 followed by 8 bytes of pow_target_spacing (9 bytes in total).
// If length is not 0 and not 9, the value can not be parsed.

if (params.size() != 1 + 8) {
throw std::runtime_error(strprintf("signet params must have length %d, got %d.", 1+8, params.size()));
}
Expand Down

0 comments on commit 64e9332

Please sign in to comment.