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 {
125
125
} else if self . v >= 27 && self . v <= 30 {
126
126
d = BigUInt ( 27 )
127
127
}
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
132
132
} else {
133
133
if ( d > v) { d = 0 }
134
134
normalizedV = self . v - d
Original file line number Diff line number Diff line change @@ -118,12 +118,11 @@ extension EthereumTransaction:Decodable {
118
118
let container = try decoder. container ( keyedBy: CodingKeys . self)
119
119
120
120
// 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 ) {
123
122
// 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 }
125
124
}
126
-
125
+
127
126
var data = try decodeHexToData ( container, key: . data, allowOptional: true )
128
127
if data != nil {
129
128
self . data = data!
You can’t perform that action at this time.
0 commit comments