mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Use assertSet consistently to check the hashes
This commit is contained in:
parent
2701acf37e
commit
8d3c93a44c
@ -345,13 +345,13 @@ function decodeHeader(data: RpcHeader): responses.Header {
|
||||
// { hash: '', parts: { total: 0, hash: '' } }
|
||||
lastBlockId: data.last_block_id.hash ? decodeBlockId(data.last_block_id) : null,
|
||||
|
||||
lastCommitHash: fromHex(assertNotEmpty(data.last_commit_hash)),
|
||||
lastCommitHash: fromHex(assertSet(data.last_commit_hash)),
|
||||
dataHash: fromHex(assertSet(data.data_hash)),
|
||||
|
||||
validatorsHash: fromHex(assertNotEmpty(data.validators_hash)),
|
||||
nextValidatorsHash: fromHex(assertNotEmpty(data.next_validators_hash)),
|
||||
consensusHash: fromHex(assertNotEmpty(data.consensus_hash)),
|
||||
appHash: fromHex(data.app_hash),
|
||||
validatorsHash: fromHex(assertSet(data.validators_hash)),
|
||||
nextValidatorsHash: fromHex(assertSet(data.next_validators_hash)),
|
||||
consensusHash: fromHex(assertSet(data.consensus_hash)),
|
||||
appHash: fromHex(assertSet(data.app_hash)),
|
||||
lastResultsHash: fromHex(assertSet(data.last_results_hash)),
|
||||
|
||||
evidenceHash: fromHex(assertSet(data.evidence_hash)),
|
||||
|
@ -277,18 +277,34 @@ export interface Header {
|
||||
*/
|
||||
readonly lastBlockId: BlockId | null;
|
||||
|
||||
// hashes of block data
|
||||
/**
|
||||
* Hashes of block data.
|
||||
*
|
||||
* This is `sha256("")` for height 1 🤷
|
||||
*/
|
||||
readonly lastCommitHash: Uint8Array;
|
||||
readonly dataHash: Uint8Array; // empty when number of transaction is 0
|
||||
/**
|
||||
* This is `sha256("")` as long as there is no data 🤷
|
||||
*/
|
||||
readonly dataHash: Uint8Array;
|
||||
|
||||
// hashes from the app output from the prev block
|
||||
readonly validatorsHash: Uint8Array;
|
||||
readonly nextValidatorsHash: Uint8Array;
|
||||
readonly consensusHash: Uint8Array;
|
||||
/**
|
||||
* This can be an empty string for height 1 and turn into "0000000000000000" later on 🤷
|
||||
*/
|
||||
readonly appHash: Uint8Array;
|
||||
/**
|
||||
* This is `sha256("")` as long as there is no data 🤷
|
||||
*/
|
||||
readonly lastResultsHash: Uint8Array;
|
||||
|
||||
// consensus info
|
||||
/**
|
||||
* This is `sha256("")` as long as there is no data 🤷
|
||||
*/
|
||||
readonly evidenceHash: Uint8Array;
|
||||
readonly proposerAddress: Uint8Array;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user