mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-31 04:02:06 +00:00
Set total difficulty to zero if not available
This commit is contained in:
parent
944db0eaf7
commit
149992c732
@ -130,7 +130,7 @@ export class EthClient implements EthClientInterface {
|
|||||||
parentHash: block.parentHash,
|
parentHash: block.parentHash,
|
||||||
timestamp: block.timestamp.toString(),
|
timestamp: block.timestamp.toString(),
|
||||||
stateRoot: this._provider.formatter.hash(rawBlock.stateRoot),
|
stateRoot: this._provider.formatter.hash(rawBlock.stateRoot),
|
||||||
td: this._provider.formatter.bigNumber(rawBlock.totalDifficulty).toString(),
|
td: this._provider.formatter.bigNumber(rawBlock.totalDifficulty ?? 0).toString(),
|
||||||
txRoot: this._provider.formatter.hash(rawBlock.transactionsRoot),
|
txRoot: this._provider.formatter.hash(rawBlock.transactionsRoot),
|
||||||
receiptRoot: this._provider.formatter.hash(rawBlock.receiptsRoot)
|
receiptRoot: this._provider.formatter.hash(rawBlock.receiptsRoot)
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ export class EthClient implements EthClientInterface {
|
|||||||
parentHash: this._provider.formatter.hash(rawBlock.parentHash),
|
parentHash: this._provider.formatter.hash(rawBlock.parentHash),
|
||||||
timestamp: this._provider.formatter.number(rawBlock.timestamp).toString(),
|
timestamp: this._provider.formatter.number(rawBlock.timestamp).toString(),
|
||||||
stateRoot: this._provider.formatter.hash(rawBlock.stateRoot),
|
stateRoot: this._provider.formatter.hash(rawBlock.stateRoot),
|
||||||
td: this._provider.formatter.bigNumber(rawBlock.totalDifficulty).toString(),
|
td: this._provider.formatter.bigNumber(rawBlock.totalDifficulty ?? 0).toString(),
|
||||||
txRoot: this._provider.formatter.hash(rawBlock.transactionsRoot),
|
txRoot: this._provider.formatter.hash(rawBlock.transactionsRoot),
|
||||||
receiptRoot: this._provider.formatter.hash(rawBlock.receiptsRoot),
|
receiptRoot: this._provider.formatter.hash(rawBlock.receiptsRoot),
|
||||||
uncleRoot: this._provider.formatter.hash(rawBlock.sha3Uncles),
|
uncleRoot: this._provider.formatter.hash(rawBlock.sha3Uncles),
|
||||||
|
Loading…
Reference in New Issue
Block a user