mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix some peer synchronization issues.
This commit is contained in:
@@ -81,7 +81,7 @@ void Peer::handleVerifyTimer(const boost::system::error_code& ecResult)
|
|||||||
nothing(); // Aborter is done.
|
nothing(); // Aborter is done.
|
||||||
}
|
}
|
||||||
else if (ecResult)
|
else if (ecResult)
|
||||||
{
|
{
|
||||||
std::cerr << "Peer verify timer error: " << std::endl;
|
std::cerr << "Peer verify timer error: " << std::endl;
|
||||||
|
|
||||||
// Can't do anything sound.
|
// Can't do anything sound.
|
||||||
@@ -525,7 +525,10 @@ void Peer::recvHello(newcoin::TMHello& packet)
|
|||||||
|
|
||||||
if ((packet.has_closedledger()) && (packet.closedledger().size() == (256 / 8)))
|
if ((packet.has_closedledger()) && (packet.closedledger().size() == (256 / 8)))
|
||||||
{
|
{
|
||||||
memcpy(mClosedLedgerHash.begin(), packet.closedledger().data(), (256 / 8));
|
memcpy(mClosedLedgerHash.begin(), packet.closedledger().data(), 256 / 8);
|
||||||
|
if ((packet.has_previousledger()) && (packet.previousledger().size() == (256 / 8)))
|
||||||
|
memcpy(mPreviousLedgerHash.begin(), packet.previousledger().data(), 256 / 8);
|
||||||
|
else mPreviousLedgerHash.zero();
|
||||||
mClosedLedgerTime = boost::posix_time::second_clock::universal_time();
|
mClosedLedgerTime = boost::posix_time::second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ private:
|
|||||||
uint256 mCookieHash;
|
uint256 mCookieHash;
|
||||||
|
|
||||||
// network state information
|
// network state information
|
||||||
uint256 mClosedLedgerHash;
|
uint256 mClosedLedgerHash, mPreviousLedgerHash;
|
||||||
boost::posix_time::ptime mClosedLedgerTime;
|
boost::posix_time::ptime mClosedLedgerTime;
|
||||||
|
|
||||||
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> mSocketSsl;
|
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> mSocketSsl;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ enum MessageType {
|
|||||||
mtGET_CONTACTS= 10;
|
mtGET_CONTACTS= 10;
|
||||||
mtCONTACT= 11;
|
mtCONTACT= 11;
|
||||||
|
|
||||||
|
|
||||||
// operations for 'small' nodes
|
// operations for 'small' nodes
|
||||||
mtSEARCH_TRANSACTION= 20;
|
mtSEARCH_TRANSACTION= 20;
|
||||||
mtGET_ACCOUNT= 21;
|
mtGET_ACCOUNT= 21;
|
||||||
@@ -22,6 +21,7 @@ enum MessageType {
|
|||||||
mtLEDGER= 32;
|
mtLEDGER= 32;
|
||||||
mtPROPOSE_LEDGER= 33;
|
mtPROPOSE_LEDGER= 33;
|
||||||
mtCLOSE_LEDGER= 35;
|
mtCLOSE_LEDGER= 35;
|
||||||
|
mtSTATUS_CHANGE= 36;
|
||||||
|
|
||||||
// data replication and synchronization
|
// data replication and synchronization
|
||||||
mtGET_VALIDATIONS= 40;
|
mtGET_VALIDATIONS= 40;
|
||||||
@@ -41,7 +41,8 @@ message TMHello {
|
|||||||
optional bytes nodePublic = 4; // node may opt to remain anonymous
|
optional bytes nodePublic = 4; // node may opt to remain anonymous
|
||||||
optional bytes nodeProof = 5;
|
optional bytes nodeProof = 5;
|
||||||
optional uint32 ipv4Port = 6;
|
optional uint32 ipv4Port = 6;
|
||||||
optional bytes closedLedger = 7;
|
optional bytes closedLedger = 7; // our last closed ledger
|
||||||
|
optional bytes previousLedger = 8; // the ledger before the last closed ledger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,6 +72,33 @@ message TMTransaction {
|
|||||||
optional bytes conflictingTransaction = 13;
|
optional bytes conflictingTransaction = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum NodeStatus {
|
||||||
|
nsCONNECTING = 1; // acquiring connections
|
||||||
|
nsCONNECTED = 2; // convinced we are connected to the real network
|
||||||
|
nsMONITORING = 3; // we know what the previous ledger is
|
||||||
|
nsVALIDATING = 4; // we have the full ledger contents
|
||||||
|
}
|
||||||
|
|
||||||
|
enum NodeEvent {
|
||||||
|
neCLOSED_LEDGER = 1; // closing a ledger because its close time has come
|
||||||
|
neACCEPTED_LEDGER = 2; // accepting a closed ledger, we have finished computing it
|
||||||
|
neSWITCHED_LEDGER = 3; // switching ledgers due to network consensus
|
||||||
|
neSHUTTING_DOWN = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message TMStatusChange {
|
||||||
|
optional NodeStatus newStatus = 1;
|
||||||
|
optional NodeEvent newEvent = 2;
|
||||||
|
optional uint32 ledgerSeq = 3;
|
||||||
|
optional bytes ledgerHash = 4;
|
||||||
|
optional bytes previousLedgerHash = 5;
|
||||||
|
optional uint64 networkTime = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message TMProposeLedger {
|
message TMProposeLedger {
|
||||||
required uint32 closingSeq = 1;
|
required uint32 closingSeq = 1;
|
||||||
required uint32 secondsSinceClose = 2;
|
required uint32 secondsSinceClose = 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user