mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Make the skip lists self-decsriptive. This change will cause old and new servers to diverge ledgers.
This commit is contained in:
@@ -1077,13 +1077,17 @@ void Ledger::updateSkipList()
|
|||||||
std::vector<uint256> hashes;
|
std::vector<uint256> hashes;
|
||||||
|
|
||||||
if (!skipList)
|
if (!skipList)
|
||||||
|
{
|
||||||
skipList = boost::make_shared<SLE>(ltLEDGER_HASHES, hash);
|
skipList = boost::make_shared<SLE>(ltLEDGER_HASHES, hash);
|
||||||
|
skipList->setFieldU32(sfFirstLedgerSequence, prevIndex);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
hashes = skipList->getFieldV256(sfHashes).peekValue();
|
hashes = skipList->getFieldV256(sfHashes).peekValue();
|
||||||
|
|
||||||
assert(hashes.size() <= 256);
|
assert(hashes.size() <= 256);
|
||||||
hashes.push_back(mParentHash);
|
hashes.push_back(mParentHash);
|
||||||
skipList->setFieldV256(sfHashes, STVector256(hashes));
|
skipList->setFieldV256(sfHashes, STVector256(hashes));
|
||||||
|
skipList->setFieldU32(sfLastLedgerSequence, prevIndex);
|
||||||
|
|
||||||
if (writeBack(lepCREATE, skipList) == lepERROR)
|
if (writeBack(lepCREATE, skipList) == lepERROR)
|
||||||
{
|
{
|
||||||
@@ -1096,7 +1100,10 @@ void Ledger::updateSkipList()
|
|||||||
SLE::pointer skipList = getSLE(hash);
|
SLE::pointer skipList = getSLE(hash);
|
||||||
std::vector<uint256> hashes;
|
std::vector<uint256> hashes;
|
||||||
if (!skipList)
|
if (!skipList)
|
||||||
|
{
|
||||||
skipList = boost::make_shared<SLE>(ltLEDGER_HASHES, hash);
|
skipList = boost::make_shared<SLE>(ltLEDGER_HASHES, hash);
|
||||||
|
skipList->setFieldU32(sfFirstLedgerSequence, prevIndex);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
hashes = skipList->getFieldV256(sfHashes).peekValue();
|
hashes = skipList->getFieldV256(sfHashes).peekValue();
|
||||||
|
|
||||||
@@ -1105,6 +1112,7 @@ void Ledger::updateSkipList()
|
|||||||
hashes.erase(hashes.begin());
|
hashes.erase(hashes.begin());
|
||||||
hashes.push_back(mParentHash);
|
hashes.push_back(mParentHash);
|
||||||
skipList->setFieldV256(sfHashes, STVector256(hashes));
|
skipList->setFieldV256(sfHashes, STVector256(hashes));
|
||||||
|
skipList->setFieldU32(sfLastLedgerSequence, prevIndex);
|
||||||
|
|
||||||
if (writeBack(lepCREATE, skipList) == lepERROR)
|
if (writeBack(lepCREATE, skipList) == lepERROR)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ static bool LEFInit()
|
|||||||
;
|
;
|
||||||
|
|
||||||
DECLARE_LEF(LedgerHashes, ltLEDGER_HASHES)
|
DECLARE_LEF(LedgerHashes, ltLEDGER_HASHES)
|
||||||
|
<< SOElement(sfFirstLedgerSequence, SOE_OPTIONAL)
|
||||||
|
<< SOElement(sfLastLedgerSequence, SOE_OPTIONAL)
|
||||||
<< SOElement(sfHashes, SOE_REQUIRED)
|
<< SOElement(sfHashes, SOE_REQUIRED)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,8 @@
|
|||||||
FIELD(BondAmount, UINT32, 23)
|
FIELD(BondAmount, UINT32, 23)
|
||||||
FIELD(LoadFee, UINT32, 24)
|
FIELD(LoadFee, UINT32, 24)
|
||||||
FIELD(OfferSequence, UINT32, 25)
|
FIELD(OfferSequence, UINT32, 25)
|
||||||
|
FIELD(FirstLedgerSequence, UINT32, 26)
|
||||||
|
FIELD(LastLedgerSequence, UINT32, 27)
|
||||||
|
|
||||||
// 64-bit integers
|
// 64-bit integers
|
||||||
FIELD(IndexNext, UINT64, 1)
|
FIELD(IndexNext, UINT64, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user