Fix bug in (redundant) check for transaction result immediately before resubmission

This commit is contained in:
Nicholas Dudfield
2013-12-29 11:55:54 +07:00
parent 65b035267c
commit 95c7acb210
2 changed files with 15 additions and 1 deletions

View File

@@ -222,6 +222,20 @@ Transaction.prototype.addSubmittedTxnID = function(hash) {
}
};
Transaction.prototype.findResultInCache = function(cache) {
var cached;
for (var i = this.submittedTxnIDs.length - 1; i >= 0; i--) {
var hash = this.submittedTxnIDs[i];
cached = cache[hash];
if (cached != null) {
break;
};
};
return cached;
};
Transaction.prototype.hash = function(prefix, as_uint256) {
if (typeof prefix === 'string') {
if (typeof hashprefixes[prefix] === 'undefined') {

View File

@@ -215,7 +215,7 @@ TransactionManager.prototype._resubmit = function(ledgers, pending) {
return;
}
var hashCached = self._cache[pending._hash];
var hashCached = pending.findResultInCache(self._cache); //[pending._hash];
self._remote._trace('transactionmanager: resubmit: %s', pending.tx_json);
if (hashCached) {