Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified Block struct #873

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Web3Core/Structure/Block/Block.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct Block {
public var receiptsRoot: Data
public var miner: EthereumAddress? // MARK: This is NOT optional in web3js
public var difficulty: BigUInt
public var totalDifficulty: BigUInt
public var totalDifficulty: BigUInt? // MARK by JoshKim: Removed from Ethereum official Blockschema (https://github.com/ethereum/execution-apis/commit/9e16d5e76a554c733613a2db631130166e2d8725)
h33min marked this conversation as resolved.
Show resolved Hide resolved
public var extraData: Data
public var size: BigUInt
public var gasLimit: BigUInt
Expand Down Expand Up @@ -83,7 +83,7 @@ extension Block: Decodable {
}

self.difficulty = try container.decodeHex(BigUInt.self, forKey: .difficulty)
self.totalDifficulty = try container.decodeHex(BigUInt.self, forKey: .totalDifficulty)
self.totalDifficulty = try? container.decodeHex(BigUInt.self, forKey: .totalDifficulty)
h33min marked this conversation as resolved.
Show resolved Hide resolved
self.extraData = try container.decodeHex(Data.self, forKey: .extraData)
self.size = try container.decodeHex(BigUInt.self, forKey: .size)
self.gasLimit = try container.decodeHex(BigUInt.self, forKey: .gasLimit)
Expand Down