Stuctures for feature enabling.

This commit is contained in:
JoelKatz
2012-12-02 15:23:17 -08:00
parent 1ed90b5bb5
commit 7708968cff
7 changed files with 23 additions and 0 deletions

View File

@@ -918,6 +918,13 @@ uint256 Ledger::getAccountRootIndex(const uint160& uAccountID)
return s.getSHA512Half();
}
uint256 Ledger::getLedgerFeatureIndex()
{ // get the index of the node that holds the last 256 ledgers
Serializer s(2);
s.add16(spaceFeature);
return s.getSHA512Half();
}
uint256 Ledger::getLedgerHashIndex()
{ // get the index of the node that holds the last 256 ledgers
Serializer s(2);

View File

@@ -193,6 +193,8 @@ public:
static int getLedgerHashOffset(uint32 desiredLedgerIndex);
static int getLedgerHashOffset(uint32 desiredLedgerIndex, uint32 currentLedgerIndex);
static uint256 getLedgerFeatureIndex();
// index calculation functions
static uint256 getAccountRootIndex(const uint160& uAccountID);

View File

@@ -98,6 +98,10 @@ static bool LEFInit()
<< SOElement(sfHashes, SOE_REQUIRED)
;
DECLARE_LEF(EnabledFeatures, ltFEATURES)
<< SOElement(sfEnabledFeatures, SOE_REQUIRED)
;
return true;
}

View File

@@ -15,6 +15,7 @@ enum LedgerEntryType
ltOFFER = 'o',
ltCONTRACT = 'c',
ltLEDGER_HASHES = 'h',
ltFEATURES = 'f',
};
// Used as a prefix for computing ledger indexes (keys).
@@ -30,6 +31,7 @@ enum LedgerNameSpace
spaceBookDir = 'B', // Directory of order books.
spaceContract = 'c',
spaceSkipList = 's',
spaceFeature = 'f',
};
enum LedgerSpecificFlags

View File

@@ -84,6 +84,7 @@
FIELD(BookDirectory, HASH256, 16)
FIELD(InvoiceID, HASH256, 17)
FIELD(Nickname, HASH256, 18)
FIELD(Feature, HASH256, 19)
// 160-bit (common)
FIELD(TakerPaysCurrency, HASH160, 1)
@@ -154,5 +155,6 @@
FIELD(Necessary, ARRAY, 6)
FIELD(Sufficient, ARRAY, 7)
FIELD(AffectedNodes, ARRAY, 8)
FIELD(EnabledFeatures, ARRAY, 9)
// vim:ts=4

View File

@@ -71,6 +71,10 @@ static bool TFInit()
<< SOElement(sfTarget, SOE_REQUIRED)
;
DECLARE_TF(EnableFeature, ttFEATURE)
<< SOElement(sfFeature, SOE_REQUIRED)
;
return true;
}

View File

@@ -19,6 +19,8 @@ enum TransactionType
ttCONTRACT_REMOVE = 10, // can we use the same msg as offer cancel
ttTRUST_SET = 20,
ttFEATURE = 100,
};
class TransactionFormat