mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 05:55:51 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -373,7 +373,7 @@ void LedgerConsensus::checkLCL()
|
|||||||
uint256 netLgr = mPrevLedgerHash;
|
uint256 netLgr = mPrevLedgerHash;
|
||||||
int netLgrCount = 0;
|
int netLgrCount = 0;
|
||||||
|
|
||||||
uint256 favoredLedger = (mState == lcsPRE_CLOSE) ? uint256() : mPrevLedgerHash; // Don't get stuck one ledger back
|
uint256 favoredLedger = mPrevLedgerHash; // Don't get stuck one ledger back or jump one forward
|
||||||
boost::unordered_map<uint256, currentValidationCount> vals =
|
boost::unordered_map<uint256, currentValidationCount> vals =
|
||||||
theApp->getValidations().getCurrentValidations(favoredLedger);
|
theApp->getValidations().getCurrentValidations(favoredLedger);
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ void LedgerConsensus::checkLCL()
|
|||||||
default: status = "unknown";
|
default: status = "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
cLog(lsWARNING) << "View of consensus changed during consensus (" << netLgrCount << ") status="
|
cLog(lsWARNING) << "View of consensus changed during " << status << " (" << netLgrCount << ") status="
|
||||||
<< status << ", " << (mHaveCorrectLCL ? "CorrectLCL" : "IncorrectLCL");
|
<< status << ", " << (mHaveCorrectLCL ? "CorrectLCL" : "IncorrectLCL");
|
||||||
cLog(lsWARNING) << mPrevLedgerHash << " to " << netLgr;
|
cLog(lsWARNING) << mPrevLedgerHash << " to " << netLgr;
|
||||||
|
|
||||||
@@ -966,8 +966,8 @@ void LedgerConsensus::addDisputedTransaction(const uint256& txID, const std::vec
|
|||||||
txn->setVote(pit.first, cit->second->hasItem(txID));
|
txn->setVote(pit.first, cit->second->hasItem(txID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ourVote && theApp->isNewFlag(txID, SF_RELAYED))
|
if (theApp->isNewFlag(txID, SF_RELAYED))
|
||||||
{ // We voted no and a trusted peer voted yes, so relay
|
{
|
||||||
ripple::TMTransaction msg;
|
ripple::TMTransaction msg;
|
||||||
msg.set_rawtransaction(&(tx.front()), tx.size());
|
msg.set_rawtransaction(&(tx.front()), tx.size());
|
||||||
msg.set_status(ripple::tsNEW);
|
msg.set_status(ripple::tsNEW);
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ namespace websocketpp
|
|||||||
|
|
||||||
void websocketLog(websocketpp::log::alevel::value v, const std::string& entry)
|
void websocketLog(websocketpp::log::alevel::value v, const std::string& entry)
|
||||||
{
|
{
|
||||||
if (v == websocketpp::log::alevel::DEVEL)
|
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
|
||||||
{
|
{
|
||||||
if (websocketPartition.doLog(lsTRACE))
|
if (websocketPartition.doLog(lsTRACE))
|
||||||
Log(lsDEBUG, websocketPartition) << entry;
|
Log(lsDEBUG, websocketPartition) << entry;
|
||||||
|
|||||||
@@ -1082,7 +1082,8 @@ Remote.prototype.account_seq = function (account, advance) {
|
|||||||
{
|
{
|
||||||
seq = account_info.seq;
|
seq = account_info.seq;
|
||||||
|
|
||||||
if (advance) account_info.seq += 1;
|
if (advance === "ADVANCE") account_info.seq += 1;
|
||||||
|
if (advance === "REWIND") account_info.seq -= 1;
|
||||||
|
|
||||||
// console.log("cached: %s current=%d next=%d", account, seq, account_info.seq);
|
// console.log("cached: %s current=%d next=%d", account, seq, account_info.seq);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,32 +312,59 @@ Transaction.prototype.submit = function (callback) {
|
|||||||
if (self.remote.local_sequence && !self.tx_json.Sequence) {
|
if (self.remote.local_sequence && !self.tx_json.Sequence) {
|
||||||
self.tx_json.Sequence = this.remote.account_seq(self.tx_json.Account, 'ADVANCE');
|
self.tx_json.Sequence = this.remote.account_seq(self.tx_json.Account, 'ADVANCE');
|
||||||
// console.log("Sequence: %s", self.tx_json.Sequence);
|
// console.log("Sequence: %s", self.tx_json.Sequence);
|
||||||
}
|
|
||||||
|
|
||||||
if (self.remote.local_sequence && !self.tx_json.Sequence) {
|
if (!self.tx_json.Sequence) {
|
||||||
// Look in the last closed ledger.
|
// Look in the last closed ledger.
|
||||||
this.remote.account_seq_cache(self.tx_json.Account, false)
|
this.remote.account_seq_cache(self.tx_json.Account, false)
|
||||||
.on('success_account_seq_cache', function () {
|
.on('success_account_seq_cache', function () {
|
||||||
// Try again.
|
// Try again.
|
||||||
self.submit();
|
self.submit();
|
||||||
})
|
})
|
||||||
.on('error_account_seq_cache', function (message) {
|
.on('error_account_seq_cache', function (message) {
|
||||||
// XXX Maybe be smarter about this. Don't want to trust an untrusted server for this seq number.
|
// XXX Maybe be smarter about this. Don't want to trust an untrusted server for this seq number.
|
||||||
|
|
||||||
// Look in the current ledger.
|
// Look in the current ledger.
|
||||||
self.remote.account_seq_cache(self.tx_json.Account, 'CURRENT')
|
self.remote.account_seq_cache(self.tx_json.Account, 'CURRENT')
|
||||||
.on('success_account_seq_cache', function () {
|
.on('success_account_seq_cache', function () {
|
||||||
// Try again.
|
// Try again.
|
||||||
self.submit();
|
self.submit();
|
||||||
})
|
})
|
||||||
.on('error_account_seq_cache', function (message) {
|
.on('error_account_seq_cache', function (message) {
|
||||||
// Forward errors.
|
// Forward errors.
|
||||||
self.emit('error', message);
|
self.emit('error', message);
|
||||||
})
|
})
|
||||||
.request();
|
.request();
|
||||||
})
|
})
|
||||||
.request();
|
.request();
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the transaction fails we want to either undo incrementing the sequence
|
||||||
|
// or submit a noop transaction to consume the sequence remotely.
|
||||||
|
this.on('success', function (res) {
|
||||||
|
if (!res || "string" !== typeof res.engine_result) return;
|
||||||
|
|
||||||
|
switch (res.engine_result.slice(0, 3)) {
|
||||||
|
// Synchronous local error
|
||||||
|
case 'tej':
|
||||||
|
self.remote.account_seq(self.tx_json.Account, 'REWIND');
|
||||||
|
break;
|
||||||
|
// XXX: What do we do in case of ter?
|
||||||
|
case 'tel':
|
||||||
|
case 'tem':
|
||||||
|
case 'tef':
|
||||||
|
// XXX Once we have a transaction submission manager class, we can
|
||||||
|
// check if there are any other transactions pending. If there are,
|
||||||
|
// we should submit a dummy transaction to ensure those
|
||||||
|
// transactions are still valid.
|
||||||
|
//var noop = self.remote.transaction().account_set(self.tx_json.Account);
|
||||||
|
//noop.submit();
|
||||||
|
|
||||||
|
// XXX Hotfix. This only works if no other transactions are pending.
|
||||||
|
self.remote.account_seq(self.tx_json.Account, 'REWIND');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare request
|
// Prepare request
|
||||||
@@ -345,8 +372,12 @@ Transaction.prototype.submit = function (callback) {
|
|||||||
var request = this.remote.request_submit();
|
var request = this.remote.request_submit();
|
||||||
|
|
||||||
// Forward successes and errors.
|
// Forward successes and errors.
|
||||||
request.on('success', function (message) { self.emit('success', message); });
|
request.on('success', function (message) {
|
||||||
request.on('error', function (message) { self.emit('error', message); });
|
self.emit('success', message);
|
||||||
|
});
|
||||||
|
request.on('error', function (message) {
|
||||||
|
self.emit('error', message);
|
||||||
|
});
|
||||||
|
|
||||||
if (!this._secret && !this.tx_json.Signature) {
|
if (!this._secret && !this.tx_json.Signature) {
|
||||||
this.emit('error', {
|
this.emit('error', {
|
||||||
|
|||||||
Reference in New Issue
Block a user