mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-21 04:35:49 +00:00
Finalized transactions should seize all activity.
This commit is contained in:
@@ -286,6 +286,9 @@ TransactionManager.prototype._request = function(tx) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function submissionError(error) {
|
function submissionError(error) {
|
||||||
|
// Finalized (e.g. aborted) transactions must stop all activity
|
||||||
|
if (tx.finalized) return;
|
||||||
|
|
||||||
if (self._is_too_busy(error)) {
|
if (self._is_too_busy(error)) {
|
||||||
self._resubmit(1, tx);
|
self._resubmit(1, tx);
|
||||||
} else {
|
} else {
|
||||||
@@ -296,6 +299,9 @@ TransactionManager.prototype._request = function(tx) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function submitted(message) {
|
function submitted(message) {
|
||||||
|
// Finalized (e.g. aborted) transactions must stop all activity
|
||||||
|
if (tx.finalized) return;
|
||||||
|
|
||||||
if (message.tx_json && message.tx_json.hash) {
|
if (message.tx_json && message.tx_json.hash) {
|
||||||
tx._hash = message.tx_json.hash;
|
tx._hash = message.tx_json.hash;
|
||||||
}
|
}
|
||||||
@@ -325,6 +331,9 @@ TransactionManager.prototype._request = function(tx) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
submitRequest.timeout(this._submissionTimeout, function() {
|
submitRequest.timeout(this._submissionTimeout, function() {
|
||||||
|
// Finalized (e.g. aborted) transactions must stop all activity
|
||||||
|
if (tx.finalized) return;
|
||||||
|
|
||||||
tx.emit('timeout');
|
tx.emit('timeout');
|
||||||
if (remote._connected) {
|
if (remote._connected) {
|
||||||
remote._trace('transactionmanager: timeout: %s', tx.tx_json);
|
remote._trace('transactionmanager: timeout: %s', tx.tx_json);
|
||||||
@@ -368,6 +377,9 @@ TransactionManager.prototype.submit = function(tx) {
|
|||||||
// If sequence number is not yet known, defer until it is.
|
// If sequence number is not yet known, defer until it is.
|
||||||
if (typeof this._nextSequence === 'undefined') {
|
if (typeof this._nextSequence === 'undefined') {
|
||||||
function sequenceLoaded() {
|
function sequenceLoaded() {
|
||||||
|
// Finalized (e.g. aborted) transactions must stop all activity
|
||||||
|
if (tx.finalized) return;
|
||||||
|
|
||||||
self.submit(tx);
|
self.submit(tx);
|
||||||
};
|
};
|
||||||
this.once('sequence_loaded', sequenceLoaded);
|
this.once('sequence_loaded', sequenceLoaded);
|
||||||
|
|||||||
Reference in New Issue
Block a user