File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Sources/Web3Core/Structure/Block Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,12 @@ extension Block: Decodable {
85
85
}
86
86
87
87
self . difficulty = try container. decodeHex ( BigUInt . self, forKey: . difficulty)
88
- self . totalDifficulty = ( try ? container. decodeHex ( BigUInt . self, forKey: . totalDifficulty) ) ?? . zero
88
+ if ( container. contains ( . totalDifficulty) ) {
89
+ // Must throw if value is set but it is invalid
90
+ self . totalDifficulty = try container. decodeHex ( BigUInt . self, forKey: . totalDifficulty)
91
+ } else {
92
+ self . totalDifficulty = . zero
93
+ }
89
94
self . extraData = try container. decodeHex ( Data . self, forKey: . extraData)
90
95
self . size = try container. decodeHex ( BigUInt . self, forKey: . size)
91
96
self . gasLimit = try container. decodeHex ( BigUInt . self, forKey: . gasLimit)
You can’t perform that action at this time.
0 commit comments