File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -125,10 +125,10 @@ public struct EthereumTransaction: CustomStringConvertible {
125125 } else if self . v >= 27 && self . v <= 30 {
126126 d = BigUInt ( 27 )
127127 }
128- if ( self . chainID != nil && self . chainID != BigUInt ( 0 ) && self . v >= ( d + self . chainID! + self . chainID! ) ) {
129- normalizedV = self . v - d - self . chainID! - self . chainID!
130- } else if ( inferedChainID != nil && self . v >= ( d + self . inferedChainID! + self . inferedChainID! ) ) {
131- normalizedV = self . v - d - inferedChainID! - inferedChainID!
128+ if let testID = self . chainID, testID != BigUInt ( 0 ) && self . v >= ( d + testID + testID ) {
129+ normalizedV = self . v - d - testID - testID
130+ } else if let testID = inferedChainID , self . v >= ( d + testID + testID ) {
131+ normalizedV = self . v - d - testID - testID
132132 } else {
133133 if ( d > v) { d = 0 }
134134 normalizedV = self . v - d
Original file line number Diff line number Diff line change @@ -118,12 +118,11 @@ extension EthereumTransaction:Decodable {
118118 let container = try decoder. container ( keyedBy: CodingKeys . self)
119119
120120 // test to see if it is a EIP-1559 wrapper
121- let envelope = try decodeHexToBigUInt ( container, key: . type, allowOptional: true )
122- if ( ( envelope != nil ) && ( envelope! != BigInt ( 0 ) ) ) {
121+ if let envelope = try decodeHexToBigUInt ( container, key: . type, allowOptional: true ) {
123122 // if present and non-sero we are a new wrapper we can't decode
124- throw Web3Error . dataError
123+ if ( envelope != BigInt ( 0 ) ) { throw Web3Error . dataError }
125124 }
126-
125+
127126 var data = try decodeHexToData ( container, key: . data, allowOptional: true )
128127 if data != nil {
129128 self . data = data!
You can’t perform that action at this time.
0 commit comments