@atomiqlabs/chain-evm 1.0.0-dev.84 → 1.0.0-dev.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -101,10 +101,17 @@ class EVMPersistentSigner extends EVMSigner_1.EVMSigner {
|
|
|
101
101
|
//Too big of an increase over the current fee rate, don't fee bump
|
|
102
102
|
this.logger.debug("checkPastTransactions(): Tx yet unconfirmed but not increasing fee for ", lastTx.hash);
|
|
103
103
|
await this.chainInterface.provider.broadcastTransaction(lastTx.serialized).catch(e => {
|
|
104
|
-
if (e.code === "NONCE_EXPIRED")
|
|
104
|
+
if (e.code === "NONCE_EXPIRED") {
|
|
105
|
+
this.logger.debug("checkPastTransactions(): Tx re-broadcast success, tx already confirmed: ", lastTx.hash);
|
|
105
106
|
return;
|
|
107
|
+
}
|
|
108
|
+
if (e.error?.message === "already known") {
|
|
109
|
+
this.logger.debug("checkPastTransactions(): Tx re-broadcast success, tx already known to the RPC: ", lastTx.hash);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
106
112
|
this.logger.error("checkPastTransactions(): Tx re-broadcast error", e);
|
|
107
113
|
});
|
|
114
|
+
data.lastBumped = Date.now();
|
|
108
115
|
continue;
|
|
109
116
|
}
|
|
110
117
|
let newTx = lastTx.clone();
|
|
@@ -176,11 +183,9 @@ class EVMPersistentSigner extends EVMSigner_1.EVMSigner {
|
|
|
176
183
|
if (transaction.nonce != null) {
|
|
177
184
|
if (transaction.nonce !== this.pendingNonce + 1)
|
|
178
185
|
throw new Error("Invalid transaction nonce!");
|
|
179
|
-
this.pendingNonce++;
|
|
180
186
|
}
|
|
181
187
|
else {
|
|
182
|
-
this.pendingNonce
|
|
183
|
-
transaction.nonce = this.pendingNonce;
|
|
188
|
+
transaction.nonce = this.pendingNonce + 1;
|
|
184
189
|
}
|
|
185
190
|
const tx = {};
|
|
186
191
|
for (let key in transaction) {
|
|
@@ -202,6 +207,8 @@ class EVMPersistentSigner extends EVMSigner_1.EVMSigner {
|
|
|
202
207
|
}
|
|
203
208
|
}
|
|
204
209
|
const pendingTxObject = { txs: [signedTx], lastBumped: Date.now(), sending: true };
|
|
210
|
+
this.pendingNonce++;
|
|
211
|
+
this.logger.debug("sendTransaction(): Incrementing pending nonce to: ", this.pendingNonce);
|
|
205
212
|
this.pendingTxs.set(transaction.nonce, pendingTxObject);
|
|
206
213
|
this.save();
|
|
207
214
|
this.chainInterface.Transactions._knownTxSet.add(signedTx.hash);
|
|
@@ -214,6 +221,7 @@ class EVMPersistentSigner extends EVMSigner_1.EVMSigner {
|
|
|
214
221
|
this.chainInterface.Transactions._knownTxSet.delete(signedTx.hash);
|
|
215
222
|
this.pendingTxs.delete(transaction.nonce);
|
|
216
223
|
this.pendingNonce--;
|
|
224
|
+
this.logger.debug("sendTransaction(): Error when broadcasting transaction, reverting pending nonce to: ", this.pendingNonce);
|
|
217
225
|
throw e;
|
|
218
226
|
}
|
|
219
227
|
});
|
package/package.json
CHANGED
|
@@ -163,9 +163,17 @@ export class EVMPersistentSigner extends EVMSigner {
|
|
|
163
163
|
//Too big of an increase over the current fee rate, don't fee bump
|
|
164
164
|
this.logger.debug("checkPastTransactions(): Tx yet unconfirmed but not increasing fee for ", lastTx.hash);
|
|
165
165
|
await this.chainInterface.provider.broadcastTransaction(lastTx.serialized).catch(e => {
|
|
166
|
-
if(e.code==="NONCE_EXPIRED")
|
|
166
|
+
if(e.code==="NONCE_EXPIRED") {
|
|
167
|
+
this.logger.debug("checkPastTransactions(): Tx re-broadcast success, tx already confirmed: ", lastTx.hash);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if(e.error?.message==="already known") {
|
|
171
|
+
this.logger.debug("checkPastTransactions(): Tx re-broadcast success, tx already known to the RPC: ", lastTx.hash);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
167
174
|
this.logger.error("checkPastTransactions(): Tx re-broadcast error", e)
|
|
168
175
|
});
|
|
176
|
+
data.lastBumped = Date.now();
|
|
169
177
|
continue;
|
|
170
178
|
}
|
|
171
179
|
|
|
@@ -250,10 +258,8 @@ export class EVMPersistentSigner extends EVMSigner {
|
|
|
250
258
|
if(transaction.nonce!=null) {
|
|
251
259
|
if(transaction.nonce !== this.pendingNonce + 1)
|
|
252
260
|
throw new Error("Invalid transaction nonce!");
|
|
253
|
-
this.pendingNonce++;
|
|
254
261
|
} else {
|
|
255
|
-
this.pendingNonce
|
|
256
|
-
transaction.nonce = this.pendingNonce;
|
|
262
|
+
transaction.nonce = this.pendingNonce + 1;
|
|
257
263
|
}
|
|
258
264
|
|
|
259
265
|
const tx: TransactionRequest = {};
|
|
@@ -277,6 +283,8 @@ export class EVMPersistentSigner extends EVMSigner {
|
|
|
277
283
|
}
|
|
278
284
|
|
|
279
285
|
const pendingTxObject = {txs: [signedTx], lastBumped: Date.now(), sending: true};
|
|
286
|
+
this.pendingNonce++;
|
|
287
|
+
this.logger.debug("sendTransaction(): Incrementing pending nonce to: ", this.pendingNonce);
|
|
280
288
|
this.pendingTxs.set(transaction.nonce, pendingTxObject);
|
|
281
289
|
this.save();
|
|
282
290
|
|
|
@@ -290,6 +298,7 @@ export class EVMPersistentSigner extends EVMSigner {
|
|
|
290
298
|
this.chainInterface.Transactions._knownTxSet.delete(signedTx.hash);
|
|
291
299
|
this.pendingTxs.delete(transaction.nonce);
|
|
292
300
|
this.pendingNonce--;
|
|
301
|
+
this.logger.debug("sendTransaction(): Error when broadcasting transaction, reverting pending nonce to: ", this.pendingNonce);
|
|
293
302
|
throw e;
|
|
294
303
|
}
|
|
295
304
|
});
|