mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Tidy up the structure of sources in protocol/:
Split out and rename STValidation Split out and rename STBlob Split out and rename STAccount Split out STPathSet Split STVector256 and move UintTypes to protocol/ Rename to STBase Rename to STLedgerEntry Rename to SOTemplate Rename to STTx Remove obsolete AgedHistory Remove types.h and add missing includes Remove unnecessary includes in app.h Remove unnecessary includes in app.h Remove include app.h from app1.cpp
This commit is contained in:
committed by
Nik Bougalis
parent
31110c7fd9
commit
08a81a0ab9
@@ -272,8 +272,6 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\beast\beast\container\tests\hash_metrics.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\Crypto.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\crypto\base64.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\beast\beast\crypto\Crypto.unity.cpp">
|
||||
@@ -1771,11 +1769,6 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\ledger\OrderBookIterator.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\ledger\SerializedValidation.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\ledger\SerializedValidation.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\main\Application.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -1864,16 +1857,6 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\ProofOfWorkFactory.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\SerializedLedger.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\SerializedLedger.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\SerializedTransaction.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\SerializedTransaction.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\Validations.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -2646,18 +2629,18 @@
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\RippleAddress.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SerializedObjectTemplate.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SerializedTypes.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\Serializer.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SField.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SOTemplate.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STAccount.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STAmount.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -2667,21 +2650,45 @@
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STArray.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STBase.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STBlob.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STInteger.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STLedgerEntry.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STObject.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STParsedJSON.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STPathSet.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STTx.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STValidation.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STVector256.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\TER.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\TxFormats.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\UintTypes.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\Indexes.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\JsonFields.h">
|
||||
@@ -2696,34 +2703,48 @@
|
||||
</None>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\RippleAddress.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedObjectTemplate.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedType.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedTypes.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\Serializer.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SField.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SOTemplate.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STAccount.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STAmount.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STArray.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBase.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBitString.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBlob.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STInteger.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STLedgerEntry.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STObject.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STParsedJSON.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STPathSet.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STTx.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STValidation.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STVector256.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\TER.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\TxFlags.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\TxFormats.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\UintTypes.h">
|
||||
</ClInclude>
|
||||
<CustomBuild Include="..\..\src\ripple\proto\ripple.proto">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='debug|x64'">protoc --cpp_out=..\..\build\proto --proto_path=%(RelativeDir) %(Identity)</Command>
|
||||
@@ -3123,8 +3144,6 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\Sitefiles.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\AgedHistory.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\Base58.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\base_uint.h">
|
||||
@@ -3156,9 +3175,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UintTypes.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\types\Issue.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\RippleAccountID.h">
|
||||
@@ -3181,8 +3197,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\UInt160.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\UintTypes.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\app.cpp">
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\unity\app.h">
|
||||
@@ -3269,8 +3283,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\unity\types.cpp">
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\unity\types.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\validators.cpp">
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\unity\websocket.cpp">
|
||||
|
||||
@@ -774,9 +774,6 @@
|
||||
<ClInclude Include="..\..\src\beast\beast\container\tests\hash_metrics.h">
|
||||
<Filter>beast\container\tests</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\Crypto.h">
|
||||
<Filter>beast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\beast\beast\crypto\base64.h">
|
||||
<Filter>beast\crypto</Filter>
|
||||
</ClInclude>
|
||||
@@ -2643,12 +2640,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\app\ledger\OrderBookIterator.h">
|
||||
<Filter>ripple\app\ledger</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\ledger\SerializedValidation.cpp">
|
||||
<Filter>ripple\app\ledger</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\ledger\SerializedValidation.h">
|
||||
<Filter>ripple\app\ledger</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\main\Application.cpp">
|
||||
<Filter>ripple\app\main</Filter>
|
||||
</ClCompile>
|
||||
@@ -2757,18 +2748,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\ProofOfWorkFactory.h">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\SerializedLedger.cpp">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\SerializedLedger.h">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\SerializedTransaction.cpp">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\misc\SerializedTransaction.h">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\misc\Validations.cpp">
|
||||
<Filter>ripple\app\misc</Filter>
|
||||
</ClCompile>
|
||||
@@ -3714,18 +3693,18 @@
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\RippleAddress.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SerializedObjectTemplate.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SerializedTypes.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\Serializer.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SField.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\SOTemplate.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STAccount.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STAmount.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
@@ -3735,21 +3714,45 @@
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STArray.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STBase.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STBlob.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STInteger.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STLedgerEntry.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STObject.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STParsedJSON.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STPathSet.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STTx.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STValidation.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\STVector256.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\TER.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\TxFormats.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\protocol\impl\UintTypes.cpp">
|
||||
<Filter>ripple\protocol\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\Indexes.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
@@ -3771,39 +3774,57 @@
|
||||
<ClInclude Include="..\..\src\ripple\protocol\RippleAddress.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedObjectTemplate.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedType.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SerializedTypes.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\Serializer.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SField.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\SOTemplate.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STAccount.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STAmount.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STArray.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBase.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBitString.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STBlob.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STInteger.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STLedgerEntry.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STObject.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STParsedJSON.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STPathSet.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STTx.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STValidation.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\STVector256.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\TER.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
@@ -3813,6 +3834,9 @@
|
||||
<ClInclude Include="..\..\src\ripple\protocol\TxFormats.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\protocol\UintTypes.h">
|
||||
<Filter>ripple\protocol</Filter>
|
||||
</ClInclude>
|
||||
<CustomBuild Include="..\..\src\ripple\proto\ripple.proto">
|
||||
<Filter>ripple\proto</Filter>
|
||||
</CustomBuild>
|
||||
@@ -4260,9 +4284,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\Sitefiles.h">
|
||||
<Filter>ripple\sitefiles</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\AgedHistory.h">
|
||||
<Filter>ripple\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\Base58.h">
|
||||
<Filter>ripple\types</Filter>
|
||||
</ClInclude>
|
||||
@@ -4302,9 +4323,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<Filter>ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UintTypes.cpp">
|
||||
<Filter>ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\types\Issue.h">
|
||||
<Filter>ripple\types</Filter>
|
||||
</ClInclude>
|
||||
@@ -4338,9 +4356,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\types\UInt160.h">
|
||||
<Filter>ripple\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\UintTypes.h">
|
||||
<Filter>ripple\types</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\app.cpp">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClCompile>
|
||||
@@ -4455,9 +4470,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\unity\types.cpp">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\unity\types.h">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\validators.cpp">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/app/book/Quality.h>
|
||||
#include <ripple/app/book/Types.h>
|
||||
|
||||
#include <ripple/app/misc/SerializedLedger.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/protocol/SField.h>
|
||||
|
||||
#include <beast/utility/noexcept.h>
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#ifndef RIPPLE_DISPUTEDTX_H
|
||||
#define RIPPLE_DISPUTEDTX_H
|
||||
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/types/base_uint.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** A transaction discovered to be in dispute during conensus.
|
||||
|
||||
@@ -17,6 +17,18 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/consensus/DisputedTx.h>
|
||||
#include <ripple/app/consensus/LedgerConsensus.h>
|
||||
#include <ripple/app/ledger/InboundLedgers.h>
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/ledger/LedgerTiming.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/misc/AmendmentTable.h>
|
||||
#include <ripple/app/misc/CanonicalTXSet.h>
|
||||
#include <ripple/app/misc/IHashRouter.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/misc/Validations.h>
|
||||
#include <ripple/app/tx/TransactionAcquire.h>
|
||||
#include <ripple/basics/CountedObject.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/core/Config.h>
|
||||
@@ -24,7 +36,9 @@
|
||||
#include <ripple/core/LoadFeeTrack.h>
|
||||
#include <ripple/overlay/Overlay.h>
|
||||
#include <ripple/overlay/predicates.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -1071,8 +1085,8 @@ private:
|
||||
{
|
||||
// Build validation
|
||||
uint256 signingHash;
|
||||
SerializedValidation::pointer v =
|
||||
std::make_shared<SerializedValidation>
|
||||
STValidation::pointer v =
|
||||
std::make_shared<STValidation>
|
||||
(newLCLHash, getApp().getOPs ().getValidationTimeNC ()
|
||||
, mValPublic, mProposing);
|
||||
v->setFieldU32 (sfLedgerSequence, newLCL->getLedgerSeq ());
|
||||
@@ -1129,8 +1143,8 @@ private:
|
||||
<< "Test applying disputed transaction that did"
|
||||
<< " not get in";
|
||||
SerializerIterator sit (it.second->peekTransaction ());
|
||||
SerializedTransaction::pointer txn
|
||||
= std::make_shared<SerializedTransaction>(sit);
|
||||
STTx::pointer txn
|
||||
= std::make_shared<STTx>(sit);
|
||||
|
||||
retriableTransactions.push_back (txn);
|
||||
anyDisputes = true;
|
||||
@@ -1467,8 +1481,8 @@ private:
|
||||
try
|
||||
{
|
||||
SerializerIterator sit (item->peekSerializer ());
|
||||
SerializedTransaction::pointer txn
|
||||
= std::make_shared<SerializedTransaction>(sit);
|
||||
STTx::pointer txn
|
||||
= std::make_shared<STTx>(sit);
|
||||
if (applyTransaction (engine, txn,
|
||||
openLgr, true) == resultRetry)
|
||||
{
|
||||
@@ -1551,7 +1565,7 @@ private:
|
||||
@return One of resultSuccess, resultFail or resultRetry.
|
||||
*/
|
||||
int applyTransaction (TransactionEngine& engine
|
||||
, SerializedTransaction::ref txn, bool openLedger, bool retryAssured)
|
||||
, STTx::ref txn, bool openLedger, bool retryAssured)
|
||||
{
|
||||
// Returns false if the transaction has need not be retried.
|
||||
TransactionEngineParams parms = openLedger ? tapOPEN_LEDGER : tapNONE;
|
||||
@@ -2002,7 +2016,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
SerializedValidation::pointer lastVal
|
||||
STValidation::pointer lastVal
|
||||
= getApp().getOPs ().getLastValidation ();
|
||||
|
||||
if (lastVal)
|
||||
@@ -2017,8 +2031,8 @@ private:
|
||||
}
|
||||
|
||||
uint256 signingHash;
|
||||
SerializedValidation::pointer v
|
||||
= std::make_shared<SerializedValidation>
|
||||
STValidation::pointer v
|
||||
= std::make_shared<STValidation>
|
||||
(mPreviousLedger->getHash ()
|
||||
, getApp().getOPs ().getValidationTimeNC (), mValPublic, false);
|
||||
addLoad(v);
|
||||
@@ -2073,7 +2087,7 @@ private:
|
||||
|
||||
/** Add our load fee to our validation
|
||||
*/
|
||||
void addLoad(SerializedValidation::ref val)
|
||||
void addLoad(STValidation::ref val)
|
||||
{
|
||||
std::uint32_t fee = std::max(
|
||||
getApp().getFeeTrack().getLocalFee(),
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
#ifndef RIPPLE_LEDGERCONSENSUS_H
|
||||
#define RIPPLE_LEDGERCONSENSUS_H
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/ledger/LedgerProposal.h>
|
||||
#include <ripple/app/misc/FeeVote.h>
|
||||
#include <ripple/app/tx/LocalTxs.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/overlay/Peer.h>
|
||||
#include <ripple/types/RippleLedgerHash.h>
|
||||
#include <beast/chrono/abstract_clock.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Manager for achieving consensus on the next ledger.
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_DATABASE_H_INCLUDED
|
||||
#define RIPPLE_DATABASE_H_INCLUDED
|
||||
|
||||
#include <ripple/types/Blob.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO Get rid of these macros
|
||||
|
||||
@@ -29,7 +29,7 @@ AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger, SerializerIterator& sit)
|
||||
Serializer txnSer (sit.getVL ());
|
||||
SerializerIterator txnIt (txnSer);
|
||||
|
||||
mTxn = std::make_shared<SerializedTransaction> (std::ref (txnIt));
|
||||
mTxn = std::make_shared<STTx> (std::ref (txnIt));
|
||||
mRawMeta = sit.getVL ();
|
||||
mMeta = std::make_shared<TransactionMetaSet> (mTxn->getTransactionID (),
|
||||
ledger->getLedgerSeq (), mRawMeta);
|
||||
@@ -39,7 +39,7 @@ AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger, SerializerIterator& sit)
|
||||
}
|
||||
|
||||
AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger,
|
||||
SerializedTransaction::ref txn, TransactionMetaSet::ref met)
|
||||
STTx::ref txn, TransactionMetaSet::ref met)
|
||||
: mLedger (ledger)
|
||||
, mTxn (txn)
|
||||
, mMeta (met)
|
||||
@@ -50,7 +50,7 @@ AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger,
|
||||
}
|
||||
|
||||
AcceptedLedgerTx::AcceptedLedgerTx (Ledger::ref ledger,
|
||||
SerializedTransaction::ref txn, TER result)
|
||||
STTx::ref txn, TER result)
|
||||
: mLedger (ledger)
|
||||
, mTxn (txn)
|
||||
, mResult (result)
|
||||
|
||||
@@ -49,11 +49,11 @@ public:
|
||||
|
||||
public:
|
||||
AcceptedLedgerTx (Ledger::ref ledger, SerializerIterator& sit);
|
||||
AcceptedLedgerTx (Ledger::ref ledger, SerializedTransaction::ref,
|
||||
AcceptedLedgerTx (Ledger::ref ledger, STTx::ref,
|
||||
TransactionMetaSet::ref);
|
||||
AcceptedLedgerTx (Ledger::ref ledger, SerializedTransaction::ref, TER result);
|
||||
AcceptedLedgerTx (Ledger::ref ledger, STTx::ref, TER result);
|
||||
|
||||
SerializedTransaction::ref getTxn () const
|
||||
STTx::ref getTxn () const
|
||||
{
|
||||
return mTxn;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
|
||||
private:
|
||||
Ledger::pointer mLedger;
|
||||
SerializedTransaction::pointer mTxn;
|
||||
STTx::pointer mTxn;
|
||||
TransactionMetaSet::pointer mMeta;
|
||||
TER mResult;
|
||||
std::vector <RippleAddress> mAffected;
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef RIPPLE_INBOUNDLEDGER_H
|
||||
#define RIPPLE_INBOUNDLEDGER_H
|
||||
|
||||
#include <ripple/app/peers/PeerSet.h>
|
||||
#include <set>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO Rename to InboundLedger
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_INBOUNDLEDGERS_H
|
||||
#define RIPPLE_INBOUNDLEDGERS_H
|
||||
|
||||
#include <ripple/app/ledger/InboundLedger.h>
|
||||
#include <ripple/types/RippleLedgerHash.h>
|
||||
#include <beast/threads/Stoppable.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
|
||||
@@ -483,25 +483,25 @@ Transaction::pointer Ledger::getTransaction (uint256 const& transID) const
|
||||
return txn;
|
||||
}
|
||||
|
||||
SerializedTransaction::pointer Ledger::getSTransaction (
|
||||
STTx::pointer Ledger::getSTransaction (
|
||||
SHAMapItem::ref item, SHAMapTreeNode::TNType type)
|
||||
{
|
||||
SerializerIterator sit (item->peekSerializer ());
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
return std::make_shared<SerializedTransaction> (sit);
|
||||
return std::make_shared<STTx> (sit);
|
||||
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
Serializer sTxn (sit.getVL ());
|
||||
SerializerIterator tSit (sTxn);
|
||||
return std::make_shared<SerializedTransaction> (tSit);
|
||||
return std::make_shared<STTx> (tSit);
|
||||
}
|
||||
|
||||
return SerializedTransaction::pointer ();
|
||||
return STTx::pointer ();
|
||||
}
|
||||
|
||||
SerializedTransaction::pointer Ledger::getSMTransaction (
|
||||
STTx::pointer Ledger::getSMTransaction (
|
||||
SHAMapItem::ref item, SHAMapTreeNode::TNType type,
|
||||
TransactionMetaSet::pointer& txMeta) const
|
||||
{
|
||||
@@ -510,7 +510,7 @@ SerializedTransaction::pointer Ledger::getSMTransaction (
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
txMeta.reset ();
|
||||
return std::make_shared<SerializedTransaction> (sit);
|
||||
return std::make_shared<STTx> (sit);
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
@@ -519,11 +519,11 @@ SerializedTransaction::pointer Ledger::getSMTransaction (
|
||||
|
||||
txMeta = std::make_shared<TransactionMetaSet> (
|
||||
item->getTag (), mLedgerSeq, sit.getVL ());
|
||||
return std::make_shared<SerializedTransaction> (tSit);
|
||||
return std::make_shared<STTx> (tSit);
|
||||
}
|
||||
|
||||
txMeta.reset ();
|
||||
return SerializedTransaction::pointer ();
|
||||
return STTx::pointer ();
|
||||
}
|
||||
|
||||
bool Ledger::getTransaction (
|
||||
@@ -758,7 +758,7 @@ bool Ledger::saveValidatedLedger (bool current)
|
||||
<< " affects no accounts";
|
||||
|
||||
db->executeSQL (
|
||||
SerializedTransaction::getMetaSQLInsertReplaceHeader () +
|
||||
STTx::getMetaSQLInsertReplaceHeader () +
|
||||
vt.second->getTxn ()->getMetaSQL (
|
||||
getLedgerSeq (), vt.second->getEscMeta ()) + ";");
|
||||
}
|
||||
@@ -1196,7 +1196,7 @@ Json::Value Ledger::getJson (int options) const
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
SerializerIterator sit (item->peekSerializer ());
|
||||
SerializedTransaction txn (sit);
|
||||
STTx txn (sit);
|
||||
txns.append (txn.getJson (0));
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
@@ -1205,7 +1205,7 @@ Json::Value Ledger::getJson (int options) const
|
||||
Serializer sTxn (sit.getVL ());
|
||||
|
||||
SerializerIterator tsit (sTxn);
|
||||
SerializedTransaction txn (tsit);
|
||||
STTx txn (tsit);
|
||||
|
||||
TransactionMetaSet meta (
|
||||
item->getTag (), mLedgerSeq, sit.getVL ());
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
#include <ripple/app/tx/Transaction.h>
|
||||
#include <ripple/app/tx/TransactionMeta.h>
|
||||
#include <ripple/app/misc/AccountState.h>
|
||||
#include <ripple/app/misc/SerializedLedger.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/basics/CountedObject.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/types/Book.h>
|
||||
#include <set>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -274,9 +275,9 @@ public:
|
||||
uint256 const& transID, TransactionMetaSet::pointer & txMeta) const;
|
||||
bool getMetaHex (uint256 const& transID, std::string & hex) const;
|
||||
|
||||
static SerializedTransaction::pointer getSTransaction (
|
||||
static STTx::pointer getSTransaction (
|
||||
SHAMapItem::ref, SHAMapTreeNode::TNType);
|
||||
SerializedTransaction::pointer getSMTransaction (
|
||||
STTx::pointer getSMTransaction (
|
||||
SHAMapItem::ref, SHAMapTreeNode::TNType,
|
||||
TransactionMetaSet::pointer & txMeta) const;
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/ledger/LedgerCleaner.h>
|
||||
#include <ripple/core/LoadFeeTrack.h>
|
||||
#include <beast/threads/Thread.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -75,7 +75,7 @@ SLE::pointer LedgerEntrySet::getEntry (uint256 const& index, LedgerEntryAction&
|
||||
if (it->second.mSeq != mSeq)
|
||||
{
|
||||
assert (it->second.mSeq < mSeq);
|
||||
it->second.mEntry = std::make_shared<SerializedLedgerEntry> (*it->second.mEntry);
|
||||
it->second.mEntry = std::make_shared<STLedgerEntry> (*it->second.mEntry);
|
||||
it->second.mSeq = mSeq;
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ SLE::pointer LedgerEntrySet::getForMod (uint256 const& node, Ledger::ref ledger,
|
||||
|
||||
if (it->second.mSeq != mSeq)
|
||||
{
|
||||
it->second.mEntry = std::make_shared<SerializedLedgerEntry> (*it->second.mEntry);
|
||||
it->second.mEntry = std::make_shared<STLedgerEntry> (*it->second.mEntry);
|
||||
it->second.mSeq = mSeq;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef RIPPLE_LEDGERHISTORY_H
|
||||
#define RIPPLE_LEDGERHISTORY_H
|
||||
|
||||
#include <ripple/types/RippleLedgerHash.h>
|
||||
#include <beast/insight/Event.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
|
||||
#include <ripple/basics/RangeSet.h>
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/ledger/LedgerHistory.h>
|
||||
#include <ripple/app/ledger/LedgerHolder.h>
|
||||
#include <ripple/app/ledger/OrderBookDB.h>
|
||||
#include <ripple/app/paths/PathRequests.h>
|
||||
#include <ripple/validators/Manager.h>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@@ -355,7 +359,7 @@ public:
|
||||
mBuildingLedgerSeq.store (i);
|
||||
}
|
||||
|
||||
TER doTransaction (SerializedTransaction::ref txn, TransactionEngineParams params, bool& didApply)
|
||||
TER doTransaction (STTx::ref txn, TransactionEngineParams params, bool& didApply)
|
||||
{
|
||||
Ledger::pointer ledger;
|
||||
TransactionEngine engine;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_LEDGERMASTER_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/types/RippleLedgerHash.h>
|
||||
#include <beast/insight/Collector.h>
|
||||
#include <beast/threads/Stoppable.h>
|
||||
#include <beast/threads/UnlockGuard.h>
|
||||
@@ -72,7 +73,7 @@ public:
|
||||
virtual bool isCaughtUp(std::string& reason) = 0;
|
||||
|
||||
virtual TER doTransaction (
|
||||
SerializedTransaction::ref txn,
|
||||
STTx::ref txn,
|
||||
TransactionEngineParams params, bool& didApply) = 0;
|
||||
|
||||
virtual int getMinValidations () = 0;
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#ifndef RIPPLE_ORDERBOOKDB_H_INCLUDED
|
||||
#define RIPPLE_ORDERBOOKDB_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/AcceptedLedgerTx.h>
|
||||
#include <ripple/app/ledger/BookListeners.h>
|
||||
#include <ripple/app/misc/OrderBook.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ bool ApplicationImp::loadOldLedger (
|
||||
|
||||
if (stp.object && (uIndex.isNonZero()))
|
||||
{
|
||||
SerializedLedgerEntry sle (*stp.object, uIndex);
|
||||
STLedgerEntry sle (*stp.object, uIndex);
|
||||
bool ok = loadLedger->addSLE (sle);
|
||||
if (!ok)
|
||||
m_journal.warning << "Couldn't add serialized ledger: " << uIndex;
|
||||
|
||||
@@ -53,14 +53,14 @@ class OrderBookDB;
|
||||
class Overlay;
|
||||
class PathRequests;
|
||||
class ProofOfWorkFactory;
|
||||
class SerializedLedgerEntry;
|
||||
class STLedgerEntry;
|
||||
class TransactionMaster;
|
||||
class Validations;
|
||||
|
||||
class DatabaseCon;
|
||||
|
||||
using NodeCache = TaggedCache <uint256, Blob>;
|
||||
using SLECache = TaggedCache <uint256, SerializedLedgerEntry>;
|
||||
using SLECache = TaggedCache <uint256, STLedgerEntry>;
|
||||
|
||||
class Application : public beast::PropertyStream::Source
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <ripple/protocol/BuildInfo.h>
|
||||
#include <beast/unit_test.h>
|
||||
#include <beast/streams/debug_ostream.h>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#if defined(BEAST_LINUX) || defined(BEAST_MAC) || defined(BEAST_BSD)
|
||||
#include <sys/resource.h>
|
||||
|
||||
@@ -30,7 +30,7 @@ AccountState::AccountState (RippleAddress const& naAccountID)
|
||||
{
|
||||
mValid = true;
|
||||
|
||||
mLedgerEntry = std::make_shared <SerializedLedgerEntry> (
|
||||
mLedgerEntry = std::make_shared <STLedgerEntry> (
|
||||
ltACCOUNT_ROOT, getAccountRootIndex (naAccountID));
|
||||
|
||||
mLedgerEntry->setFieldAccount (sfAccount, naAccountID.getAccountID ());
|
||||
|
||||
@@ -58,17 +58,17 @@ public:
|
||||
return mLedgerEntry->getFieldU32 (sfSequence);
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::pointer getSLE ()
|
||||
STLedgerEntry::pointer getSLE ()
|
||||
{
|
||||
return mLedgerEntry;
|
||||
}
|
||||
|
||||
SerializedLedgerEntry const& peekSLE () const
|
||||
STLedgerEntry const& peekSLE () const
|
||||
{
|
||||
return *mLedgerEntry;
|
||||
}
|
||||
|
||||
SerializedLedgerEntry& peekSLE ()
|
||||
STLedgerEntry& peekSLE ()
|
||||
{
|
||||
return *mLedgerEntry;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
private:
|
||||
RippleAddress const mAccountID;
|
||||
RippleAddress mAuthorizedKey;
|
||||
SerializedLedgerEntry::pointer mLedgerEntry;
|
||||
STLedgerEntry::pointer mLedgerEntry;
|
||||
|
||||
bool mValid;
|
||||
};
|
||||
|
||||
@@ -473,7 +473,7 @@ AmendmentTableImpl::doVoting (Ledger::ref lastClosedLedger,
|
||||
"Voting for amendment: " << uAmendment;
|
||||
|
||||
// Create the transaction to enable the amendment
|
||||
SerializedTransaction trans (ttAMENDMENT);
|
||||
STTx trans (ttAMENDMENT);
|
||||
trans.setFieldAccount (sfAccount, Account ());
|
||||
trans.setFieldH256 (sfAmendment, uAmendment);
|
||||
uint256 txID = trans.getTransactionID ();
|
||||
|
||||
@@ -71,7 +71,7 @@ bool CanonicalTXSet::Key::operator>= (Key const& rhs)const
|
||||
return mTXid >= rhs.mTXid;
|
||||
}
|
||||
|
||||
void CanonicalTXSet::push_back (SerializedTransaction::ref txn)
|
||||
void CanonicalTXSet::push_back (STTx::ref txn)
|
||||
{
|
||||
uint256 effectiveAccount = mSetHash;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_CANONICALTXSET_H
|
||||
#define RIPPLE_CANONICALTXSET_H
|
||||
|
||||
#include <ripple/types/RippleLedgerHash.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Holds transactions which were deferred to the next pass of consensus.
|
||||
@@ -68,8 +70,8 @@ public:
|
||||
std::uint32_t mSeq;
|
||||
};
|
||||
|
||||
typedef std::map <Key, SerializedTransaction::pointer>::iterator iterator;
|
||||
typedef std::map <Key, SerializedTransaction::pointer>::const_iterator const_iterator;
|
||||
typedef std::map <Key, STTx::pointer>::iterator iterator;
|
||||
typedef std::map <Key, STTx::pointer>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
explicit CanonicalTXSet (LedgerHash const& lastClosedLedgerHash)
|
||||
@@ -77,7 +79,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void push_back (SerializedTransaction::ref txn);
|
||||
void push_back (STTx::ref txn);
|
||||
|
||||
// VFALCO TODO remove this function
|
||||
void reset (LedgerHash const& newLastClosedLedgerHash)
|
||||
@@ -118,7 +120,7 @@ private:
|
||||
// Used to salt the accounts so people can't mine for low account numbers
|
||||
uint256 mSetHash;
|
||||
|
||||
std::map <Key, SerializedTransaction::pointer> mMap;
|
||||
std::map <Key, STTx::pointer> mMap;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -158,7 +158,7 @@ FeeVoteImpl::doVoting (Ledger::ref lastClosedLedger,
|
||||
lastClosedLedger->getParentHash ());
|
||||
for (auto const& e : set)
|
||||
{
|
||||
SerializedValidation const& val = *e.second;
|
||||
STValidation const& val = *e.second;
|
||||
|
||||
if (val.isTrusted ())
|
||||
{
|
||||
@@ -206,7 +206,7 @@ FeeVoteImpl::doVoting (Ledger::ref lastClosedLedger,
|
||||
"/" << baseReserve <<
|
||||
"/" << incReserve;
|
||||
|
||||
SerializedTransaction trans (ttFEE);
|
||||
STTx trans (ttFEE);
|
||||
trans.setFieldAccount (sfAccount, Account ());
|
||||
trans.setFieldU64 (sfBaseFee, baseFee);
|
||||
trans.setFieldU32 (sfReferenceFeeUnits, 10);
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef RIPPLE_HASHROUTER_H_INCLUDED
|
||||
#define RIPPLE_HASHROUTER_H_INCLUDED
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO NOTE Are these the flags?? Why aren't we using a packed struct?
|
||||
|
||||
@@ -161,11 +161,11 @@ public:
|
||||
return m_ledgerMaster.getFullValidatedRange (minVal, maxVal);
|
||||
}
|
||||
|
||||
SerializedValidation::ref getLastValidation ()
|
||||
STValidation::ref getLastValidation ()
|
||||
{
|
||||
return mLastValidation;
|
||||
}
|
||||
void setLastValidation (SerializedValidation::ref v)
|
||||
void setLastValidation (STValidation::ref v)
|
||||
{
|
||||
mLastValidation = v;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
// must complete immediately
|
||||
typedef std::function<void (Transaction::pointer, TER)> stCallback;
|
||||
void submitTransaction (
|
||||
Job&, SerializedTransaction::pointer,
|
||||
Job&, STTx::pointer,
|
||||
stCallback callback = stCallback ());
|
||||
|
||||
Transaction::pointer submitTransactionSync (
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
const std::list< Blob >& nodeData);
|
||||
|
||||
bool recvValidation (
|
||||
SerializedValidation::ref val, std::string const& source);
|
||||
STValidation::ref val, std::string const& source);
|
||||
void takePosition (int seq, SHAMap::ref position);
|
||||
SHAMap::pointer getTXMap (uint256 const& hash);
|
||||
bool hasTXSet (
|
||||
@@ -382,7 +382,7 @@ public:
|
||||
m_localTX->sweep (newValidLedger);
|
||||
}
|
||||
void addLocalTx (
|
||||
Ledger::ref openLedger, SerializedTransaction::ref txn) override
|
||||
Ledger::ref openLedger, STTx::ref txn) override
|
||||
{
|
||||
m_localTX->push_back (openLedger->getLedgerSeq(), txn);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ public:
|
||||
//
|
||||
void pubLedger (Ledger::ref lpAccepted);
|
||||
void pubProposedTransaction (
|
||||
Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult);
|
||||
Ledger::ref lpCurrent, STTx::ref stTxn, TER terResult);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
@@ -488,7 +488,7 @@ private:
|
||||
void setMode (OperatingMode);
|
||||
|
||||
Json::Value transJson (
|
||||
const SerializedTransaction& stTxn, TER terResult, bool bValidated,
|
||||
const STTx& stTxn, TER terResult, bool bValidated,
|
||||
Ledger::ref lpCurrent);
|
||||
bool haveConsensusObject ();
|
||||
|
||||
@@ -549,7 +549,7 @@ private:
|
||||
|
||||
std::uint32_t mLastCloseTime;
|
||||
std::uint32_t mLastValidationTime;
|
||||
SerializedValidation::pointer mLastValidation;
|
||||
STValidation::pointer mLastValidation;
|
||||
|
||||
// Recent positions taken
|
||||
std::map<uint256, std::pair<int, SHAMap::pointer> > mRecentPositions;
|
||||
@@ -834,14 +834,14 @@ bool NetworkOPsImp::isValidated (std::uint32_t seq)
|
||||
}
|
||||
|
||||
void NetworkOPsImp::submitTransaction (
|
||||
Job&, SerializedTransaction::pointer iTrans, stCallback callback)
|
||||
Job&, STTx::pointer iTrans, stCallback callback)
|
||||
{
|
||||
// this is an asynchronous interface
|
||||
Serializer s;
|
||||
iTrans->add (s);
|
||||
|
||||
SerializerIterator sit (s);
|
||||
auto trans = std::make_shared<SerializedTransaction> (std::ref (sit));
|
||||
auto trans = std::make_shared<STTx> (std::ref (sit));
|
||||
|
||||
uint256 suppress = trans->getTransactionID ();
|
||||
int flags;
|
||||
@@ -2235,7 +2235,7 @@ NetworkOPsImp::getLedgerAffectedAccounts (std::uint32_t ledgerSeq)
|
||||
}
|
||||
|
||||
bool NetworkOPsImp::recvValidation (
|
||||
SerializedValidation::ref val, std::string const& source)
|
||||
STValidation::ref val, std::string const& source)
|
||||
{
|
||||
m_journal.debug << "recvValidation " << val->getLedgerHash ()
|
||||
<< " from " << source;
|
||||
@@ -2449,7 +2449,7 @@ Json::Value NetworkOPsImp::pubBootstrapAccountInfo (
|
||||
}
|
||||
|
||||
void NetworkOPsImp::pubProposedTransaction (
|
||||
Ledger::ref lpCurrent, SerializedTransaction::ref stTxn, TER terResult)
|
||||
Ledger::ref lpCurrent, STTx::ref stTxn, TER terResult)
|
||||
{
|
||||
Json::Value jvObj = transJson (*stTxn, terResult, false, lpCurrent);
|
||||
|
||||
@@ -2549,7 +2549,7 @@ void NetworkOPsImp::reportFeeChange ()
|
||||
// This routine should only be used to publish accepted or validated
|
||||
// transactions.
|
||||
Json::Value NetworkOPsImp::transJson(
|
||||
const SerializedTransaction& stTxn, TER terResult, bool bValidated,
|
||||
const STTx& stTxn, TER terResult, bool bValidated,
|
||||
Ledger::ref lpCurrent)
|
||||
{
|
||||
Json::Value jvObj (Json::objectValue);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef RIPPLE_NETWORKOPS_H
|
||||
#define RIPPLE_NETWORKOPS_H
|
||||
|
||||
#include <ripple/app/ledger/SerializedValidation.h>
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <ripple/net/InfoSub.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
#include <beast/threads/Stoppable.h>
|
||||
@@ -128,8 +128,8 @@ public:
|
||||
virtual bool getValidatedRange (std::uint32_t& minVal, std::uint32_t& maxVal) = 0;
|
||||
virtual bool getFullValidatedRange (std::uint32_t& minVal, std::uint32_t& maxVal) = 0;
|
||||
|
||||
virtual SerializedValidation::ref getLastValidation () = 0;
|
||||
virtual void setLastValidation (SerializedValidation::ref v) = 0;
|
||||
virtual STValidation::ref getLastValidation () = 0;
|
||||
virtual void setLastValidation (STValidation::ref v) = 0;
|
||||
virtual SLE::pointer getSLE (Ledger::pointer lpLedger, uint256 const& uHash) = 0;
|
||||
virtual SLE::pointer getSLEi (Ledger::pointer lpLedger, uint256 const& uHash) = 0;
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
// must complete immediately
|
||||
// VFALCO TODO Make this a TxCallback structure
|
||||
typedef std::function<void (Transaction::pointer, TER)> stCallback;
|
||||
virtual void submitTransaction (Job&, SerializedTransaction::pointer,
|
||||
virtual void submitTransaction (Job&, STTx::pointer,
|
||||
stCallback callback = stCallback ()) = 0;
|
||||
virtual Transaction::pointer submitTransactionSync (Transaction::ref tpTrans,
|
||||
bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit) = 0;
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
uint256 const& hash, const std::list<SHAMapNodeID>& nodeIDs,
|
||||
const std::list< Blob >& nodeData) = 0;
|
||||
|
||||
virtual bool recvValidation (SerializedValidation::ref val,
|
||||
virtual bool recvValidation (STValidation::ref val,
|
||||
std::string const& source) = 0;
|
||||
|
||||
virtual void takePosition (int seq, SHAMap::ref position) = 0;
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
virtual void reportFeeChange () = 0;
|
||||
|
||||
virtual void updateLocalTx (Ledger::ref newValidLedger) = 0;
|
||||
virtual void addLocalTx (Ledger::ref openLedger, SerializedTransaction::ref txn) = 0;
|
||||
virtual void addLocalTx (Ledger::ref openLedger, STTx::ref txn) = 0;
|
||||
virtual std::size_t getLocalTxCount () = 0;
|
||||
|
||||
//Helper function to generate SQL query to get transactions
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
//
|
||||
virtual void pubLedger (Ledger::ref lpAccepted) = 0;
|
||||
virtual void pubProposedTransaction (Ledger::ref lpCurrent,
|
||||
SerializedTransaction::ref stTxn, TER terResult) = 0;
|
||||
STTx::ref stTxn, TER terResult) = 0;
|
||||
};
|
||||
|
||||
std::unique_ptr<NetworkOPs>
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool addValidation (SerializedValidation::ref val, std::string const& source)
|
||||
bool addValidation (STValidation::ref val, std::string const& source)
|
||||
{
|
||||
RippleAddress signer = val->getSignerPublic ();
|
||||
bool isCurrent = false;
|
||||
@@ -293,11 +293,11 @@ private:
|
||||
return (goodNodes * 100) / (goodNodes + badNodes);
|
||||
}
|
||||
|
||||
std::list<SerializedValidation::pointer> getCurrentTrustedValidations ()
|
||||
std::list<STValidation::pointer> getCurrentTrustedValidations ()
|
||||
{
|
||||
std::uint32_t cutoff = getApp().getOPs ().getNetworkTimeNC () - LEDGER_VAL_INTERVAL;
|
||||
|
||||
std::list<SerializedValidation::pointer> ret;
|
||||
std::list<STValidation::pointer> ret;
|
||||
|
||||
ScopedLockType sl (mLock);
|
||||
auto it = mCurrentValidations.begin ();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#ifndef RIPPLE_VALIDATIONS_H_INCLUDED
|
||||
#define RIPPLE_VALIDATIONS_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
namespace ripple {
|
||||
@@ -27,11 +28,11 @@ namespace ripple {
|
||||
// VFALCO TODO rename and move these typedefs into the Validations interface
|
||||
|
||||
// nodes validating and highest node ID validating
|
||||
typedef hash_map<NodeID, SerializedValidation::pointer> ValidationSet;
|
||||
typedef hash_map<NodeID, STValidation::pointer> ValidationSet;
|
||||
|
||||
typedef std::pair<int, NodeID> ValidationCounter;
|
||||
typedef hash_map<uint256, ValidationCounter> LedgerToValidationCounter;
|
||||
typedef std::vector<SerializedValidation::pointer> ValidationVector;
|
||||
typedef std::vector<STValidation::pointer> ValidationVector;
|
||||
|
||||
class Validations : beast::LeakChecked <Validations>
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
|
||||
virtual ~Validations () { }
|
||||
|
||||
virtual bool addValidation (SerializedValidation::ref, std::string const& source) = 0;
|
||||
virtual bool addValidation (STValidation::ref, std::string const& source) = 0;
|
||||
|
||||
virtual ValidationSet getValidations (uint256 const& ledger) = 0;
|
||||
|
||||
@@ -63,7 +64,7 @@ public:
|
||||
virtual LedgerToValidationCounter getCurrentValidations (
|
||||
uint256 currentLedger, uint256 previousLedger) = 0;
|
||||
|
||||
virtual std::list <SerializedValidation::pointer>
|
||||
virtual std::list <STValidation::pointer>
|
||||
getCurrentTrustedValidations () = 0;
|
||||
|
||||
virtual void tune (int size, int age) = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/app/paths/NodeDirectory.h>
|
||||
#include <ripple/app/paths/Types.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace path {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/core/LoadFeeTrack.h>
|
||||
#include <ripple/net/RPCErr.h>
|
||||
#include <ripple/rpc/ErrorCodes.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <tuple>
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef RIPPLE_PATHREQUEST_H
|
||||
#define RIPPLE_PATHREQUEST_H
|
||||
|
||||
#include <ripple/app/paths/RippleLineCache.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// A pathfinding request submitted by a client
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_PATHREQUESTS_H
|
||||
#define RIPPLE_PATHREQUESTS_H
|
||||
|
||||
#include <ripple/app/paths/PathRequest.h>
|
||||
#include <ripple/app/paths/RippleLineCache.h>
|
||||
#include <ripple/core/Job.h>
|
||||
#include <atomic>
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#ifndef RIPPLE_RIPPLELINECACHE_H
|
||||
#define RIPPLE_RIPPLELINECACHE_H
|
||||
|
||||
#include <ripple/app/paths/RippleState.h>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// Used by Pathfinder
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace ripple {
|
||||
|
||||
RippleState::pointer RippleState::makeItem (
|
||||
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry)
|
||||
Account const& accountID, STLedgerEntry::ref ledgerEntry)
|
||||
{
|
||||
if (!ledgerEntry || ledgerEntry->getType () != ltRIPPLE_STATE)
|
||||
return pointer ();
|
||||
@@ -29,7 +29,7 @@ RippleState::pointer RippleState::makeItem (
|
||||
}
|
||||
|
||||
RippleState::RippleState (
|
||||
SerializedLedgerEntry::ref ledgerEntry,
|
||||
STLedgerEntry::ref ledgerEntry,
|
||||
Account const& viewAccount)
|
||||
: mLedgerEntry (ledgerEntry)
|
||||
, mLowLimit (ledgerEntry->getFieldAmount (sfLowLimit))
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
virtual ~RippleState () { }
|
||||
|
||||
static RippleState::pointer makeItem (
|
||||
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry);
|
||||
Account const& accountID, STLedgerEntry::ref ledgerEntry);
|
||||
|
||||
LedgerEntryType getType ()
|
||||
{
|
||||
@@ -113,17 +113,17 @@ public:
|
||||
return ((std::uint32_t) (mViewLowest ? mLowQualityOut : mHighQualityOut));
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::pointer getSLE ()
|
||||
STLedgerEntry::pointer getSLE ()
|
||||
{
|
||||
return mLedgerEntry;
|
||||
}
|
||||
|
||||
const SerializedLedgerEntry& peekSLE () const
|
||||
const STLedgerEntry& peekSLE () const
|
||||
{
|
||||
return *mLedgerEntry;
|
||||
}
|
||||
|
||||
SerializedLedgerEntry& peekSLE ()
|
||||
STLedgerEntry& peekSLE ()
|
||||
{
|
||||
return *mLedgerEntry;
|
||||
}
|
||||
@@ -134,11 +134,11 @@ public:
|
||||
|
||||
private:
|
||||
RippleState (
|
||||
SerializedLedgerEntry::ref ledgerEntry,
|
||||
STLedgerEntry::ref ledgerEntry,
|
||||
Account const& viewAccount);
|
||||
|
||||
private:
|
||||
SerializedLedgerEntry::pointer mLedgerEntry;
|
||||
STLedgerEntry::pointer mLedgerEntry;
|
||||
|
||||
bool mViewLowest;
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/shamap/SHAMapSyncFilters.h>
|
||||
#include <ripple/app/tx/TransactionMaster.h>
|
||||
#include <ripple/nodestore/Database.h>
|
||||
#include <ripple/protocol/HashPrefix.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -43,7 +46,7 @@ void ConsensusTransSetSF::gotNode (bool fromFilter, const SHAMapNodeID& id, uint
|
||||
{
|
||||
Serializer s (nodeData.begin () + 4, nodeData.end ()); // skip prefix
|
||||
SerializerIterator sit (s);
|
||||
SerializedTransaction::pointer stx = std::make_shared<SerializedTransaction> (std::ref (sit));
|
||||
STTx::pointer stx = std::make_shared<STTx> (std::ref (sit));
|
||||
assert (stx->getTransactionID () == nodeHash);
|
||||
getApp().getJobQueue ().addJob (
|
||||
jtTRANSACTION, "TXS->TXN",
|
||||
|
||||
@@ -24,7 +24,7 @@ class AddWallet
|
||||
{
|
||||
public:
|
||||
AddWallet (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_AddWallet (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class CancelOffer
|
||||
{
|
||||
public:
|
||||
CancelOffer (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_CancelOffer (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class CancelTicket
|
||||
{
|
||||
public:
|
||||
CancelTicket (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_CancelTicket (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ class Change
|
||||
{
|
||||
public:
|
||||
Change (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
|
||||
TER
|
||||
transact_Change (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
public:
|
||||
CreateOffer (
|
||||
bool autobridging,
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -582,7 +582,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_CreateOffer (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class CreateTicket
|
||||
{
|
||||
public:
|
||||
CreateTicket (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_CreateTicket (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class Payment
|
||||
|
||||
public:
|
||||
Payment (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_Payment (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ class SetAccount
|
||||
|
||||
public:
|
||||
SetAccount (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -338,7 +338,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_SetAccount (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ class SetRegularKey
|
||||
|
||||
public:
|
||||
SetRegularKey (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_SetRegularKey (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class SetTrust
|
||||
{
|
||||
public:
|
||||
SetTrust (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
: Transactor (
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
|
||||
TER
|
||||
transact_SetTrust (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
|
||||
@@ -22,20 +22,20 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
TER transact_Payment (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetAccount (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetRegularKey (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetTrust (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CreateOffer (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CancelOffer (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_AddWallet (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_Change (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CreateTicket (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CancelTicket (SerializedTransaction const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_Payment (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetAccount (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetRegularKey (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_SetTrust (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CreateOffer (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CancelOffer (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_AddWallet (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_Change (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CreateTicket (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
TER transact_CancelTicket (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
|
||||
TER
|
||||
Transactor::transact (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ Transactor::transact (
|
||||
}
|
||||
|
||||
Transactor::Transactor (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine,
|
||||
beast::Journal journal)
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
static
|
||||
TER
|
||||
transact (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine);
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
apply ();
|
||||
|
||||
protected:
|
||||
SerializedTransaction const& mTxn;
|
||||
STTx const& mTxn;
|
||||
TransactionEngine* mEngine;
|
||||
TransactionEngineParams mParams;
|
||||
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
virtual TER doApply () = 0;
|
||||
|
||||
Transactor (
|
||||
const SerializedTransaction& txn,
|
||||
const STTx& txn,
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine,
|
||||
beast::Journal journal = beast::Journal ());
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
// get into a fully-validated ledger.
|
||||
static int const holdLedgers = 5;
|
||||
|
||||
LocalTx (LedgerIndex index, SerializedTransaction::ref txn)
|
||||
LocalTx (LedgerIndex index, STTx::ref txn)
|
||||
: m_txn (txn)
|
||||
, m_expire (index + holdLedgers)
|
||||
, m_id (txn->getTransactionID ())
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
return i > m_expire;
|
||||
}
|
||||
|
||||
SerializedTransaction::ref getTX () const
|
||||
STTx::ref getTX () const
|
||||
{
|
||||
return m_txn;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
SerializedTransaction::pointer m_txn;
|
||||
STTx::pointer m_txn;
|
||||
LedgerIndex m_expire;
|
||||
uint256 m_id;
|
||||
RippleAddress m_account;
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
{ }
|
||||
|
||||
// Add a new transaction to the set of local transactions
|
||||
void push_back (LedgerIndex index, SerializedTransaction::ref txn) override
|
||||
void push_back (LedgerIndex index, STTx::ref txn) override
|
||||
{
|
||||
std::lock_guard <std::mutex> lock (m_lock);
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef RIPPLE_LOCALTRANSACTIONS_H
|
||||
#define RIPPLE_LOCALTRANSACTIONS_H
|
||||
|
||||
#include <ripple/app/tx/TransactionEngine.h>
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// Track transactions issued by local clients
|
||||
@@ -35,7 +38,7 @@ public:
|
||||
static std::unique_ptr<LocalTxs> New ();
|
||||
|
||||
// Add a new local transaction
|
||||
virtual void push_back (LedgerIndex index, SerializedTransaction::ref txn) = 0;
|
||||
virtual void push_back (LedgerIndex index, STTx::ref txn) = 0;
|
||||
|
||||
// Apply local transactions to a new open ledger
|
||||
virtual void apply (TransactionEngine&) = 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
Transaction::Transaction (SerializedTransaction::ref sit, Validate validate)
|
||||
Transaction::Transaction (STTx::ref sit, Validate validate)
|
||||
: mInLedger (0),
|
||||
mStatus (INVALID),
|
||||
mResult (temUNCERTAIN),
|
||||
@@ -52,7 +52,7 @@ Transaction::pointer Transaction::sharedTransaction (
|
||||
SerializerIterator sit (s);
|
||||
|
||||
return std::make_shared<Transaction> (
|
||||
std::make_shared<SerializedTransaction> (sit),
|
||||
std::make_shared<STTx> (sit),
|
||||
validate);
|
||||
}
|
||||
catch (...)
|
||||
@@ -105,7 +105,7 @@ Transaction::pointer Transaction::transactionFromSQL (
|
||||
rawTxn.resize (txSize);
|
||||
|
||||
SerializerIterator it (rawTxn);
|
||||
auto txn = std::make_shared<SerializedTransaction> (it);
|
||||
auto txn = std::make_shared<STTx> (it);
|
||||
auto tr = std::make_shared<Transaction> (txn, validate);
|
||||
|
||||
TransStatus st (INVALID);
|
||||
@@ -177,7 +177,7 @@ Transaction::pointer Transaction::transactionFromSQL (std::string const& sql)
|
||||
rawTxn.resize (txSize);
|
||||
|
||||
SerializerIterator it (rawTxn);
|
||||
auto txn = std::make_shared<SerializedTransaction> (it);
|
||||
auto txn = std::make_shared<STTx> (it);
|
||||
auto tr = std::make_shared<Transaction> (txn, Validate::YES);
|
||||
|
||||
TransStatus st (INVALID);
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
#ifndef RIPPLE_TRANSACTION_H
|
||||
#define RIPPLE_TRANSACTION_H
|
||||
|
||||
#include <ripple/app/misc/SerializedTransaction.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -60,14 +61,14 @@ public:
|
||||
typedef const pointer& ref;
|
||||
|
||||
public:
|
||||
Transaction (SerializedTransaction::ref, Validate);
|
||||
Transaction (STTx::ref, Validate);
|
||||
|
||||
static Transaction::pointer sharedTransaction (Blob const&, Validate);
|
||||
static Transaction::pointer transactionFromSQL (Database*, Validate);
|
||||
|
||||
bool checkSign () const;
|
||||
|
||||
SerializedTransaction::ref getSTransaction ()
|
||||
STTx::ref getSTransaction ()
|
||||
{
|
||||
return mTransaction;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ private:
|
||||
TransStatus mStatus;
|
||||
TER mResult;
|
||||
|
||||
SerializedTransaction::pointer mTransaction;
|
||||
STTx::pointer mTransaction;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_TRANSACTIONACQUIRE_H
|
||||
#define RIPPLE_TRANSACTIONACQUIRE_H
|
||||
|
||||
#include <ripple/app/peers/PeerSet.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO rename to PeerTxRequest
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ripple {
|
||||
|
||||
// Double check a transaction's metadata to make sure no system invariants were broken
|
||||
|
||||
bool TransactionEngine::checkInvariants (TER result, const SerializedTransaction& txn, TransactionEngineParams params)
|
||||
bool TransactionEngine::checkInvariants (TER result, const STTx& txn, TransactionEngineParams params)
|
||||
{
|
||||
// VFALCO I deleted a bunch of code that was wrapped in #if 0.
|
||||
// If you need it, check the commit log.
|
||||
|
||||
@@ -71,7 +71,7 @@ void TransactionEngine::txnWrite ()
|
||||
}
|
||||
|
||||
TER TransactionEngine::applyTransaction (
|
||||
SerializedTransaction const& txn,
|
||||
STTx const& txn,
|
||||
TransactionEngineParams params,
|
||||
bool& didApply)
|
||||
{
|
||||
@@ -86,7 +86,7 @@ TER TransactionEngine::applyTransaction (
|
||||
Serializer ser;
|
||||
txn.add (ser);
|
||||
SerializerIterator sit (ser);
|
||||
SerializedTransaction s2 (sit);
|
||||
STTx s2 (sit);
|
||||
|
||||
if (!s2.isEquivalent (txn))
|
||||
{
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef __TRANSACTIONENGINE__
|
||||
#define __TRANSACTIONENGINE__
|
||||
#ifndef RIPPLE_APP_TRANSACTIONENGINE_H_INCLUDED
|
||||
#define RIPPLE_APP_TRANSACTIONENGINE_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/ledger/LedgerEntrySet.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -36,8 +39,8 @@ public:
|
||||
private:
|
||||
LedgerEntrySet mNodes;
|
||||
|
||||
TER setAuthorized (const SerializedTransaction & txn, bool bMustSetGenerator);
|
||||
TER checkSig (const SerializedTransaction & txn);
|
||||
TER setAuthorized (const STTx & txn, bool bMustSetGenerator);
|
||||
TER checkSig (const STTx & txn);
|
||||
|
||||
protected:
|
||||
Ledger::pointer mLedger;
|
||||
@@ -95,8 +98,8 @@ public:
|
||||
mNodes.entryModify (sleEntry);
|
||||
}
|
||||
|
||||
TER applyTransaction (const SerializedTransaction&, TransactionEngineParams, bool & didApply);
|
||||
bool checkInvariants (TER result, const SerializedTransaction & txn, TransactionEngineParams params);
|
||||
TER applyTransaction (const STTx&, TransactionEngineParams, bool & didApply);
|
||||
bool checkInvariants (TER result, const STTx & txn, TransactionEngineParams params);
|
||||
};
|
||||
|
||||
inline TransactionEngineParams operator| (const TransactionEngineParams& l1, const TransactionEngineParams& l2)
|
||||
|
||||
@@ -55,11 +55,11 @@ Transaction::pointer TransactionMaster::fetch (uint256 const& txnID, bool checkD
|
||||
return txn;
|
||||
}
|
||||
|
||||
SerializedTransaction::pointer TransactionMaster::fetch (SHAMapItem::ref item,
|
||||
STTx::pointer TransactionMaster::fetch (SHAMapItem::ref item,
|
||||
SHAMapTreeNode::TNType type,
|
||||
bool checkDisk, std::uint32_t uCommitLedger)
|
||||
{
|
||||
SerializedTransaction::pointer txn;
|
||||
STTx::pointer txn;
|
||||
Transaction::pointer iTx = getApp().getMasterTransaction ().fetch (item->getTag (), false);
|
||||
|
||||
if (!iTx)
|
||||
@@ -68,7 +68,7 @@ SerializedTransaction::pointer TransactionMaster::fetch (SHAMapItem::ref item,
|
||||
if (type == SHAMapTreeNode::tnTRANSACTION_NM)
|
||||
{
|
||||
SerializerIterator sit (item->peekSerializer ());
|
||||
txn = std::make_shared<SerializedTransaction> (std::ref (sit));
|
||||
txn = std::make_shared<STTx> (std::ref (sit));
|
||||
}
|
||||
else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ SerializedTransaction::pointer TransactionMaster::fetch (SHAMapItem::ref item,
|
||||
item->peekSerializer ().getVL (s.modData (), 0, length);
|
||||
SerializerIterator sit (s);
|
||||
|
||||
txn = std::make_shared<SerializedTransaction> (std::ref (sit));
|
||||
txn = std::make_shared<STTx> (std::ref (sit));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
TransactionMaster ();
|
||||
|
||||
Transaction::pointer fetch (uint256 const& , bool checkDisk);
|
||||
SerializedTransaction::pointer fetch (SHAMapItem::ref item, SHAMapTreeNode:: TNType type,
|
||||
STTx::pointer fetch (SHAMapItem::ref item, SHAMapTreeNode:: TNType type,
|
||||
bool checkDisk, std::uint32_t uCommitLedger);
|
||||
|
||||
// return value: true = we had the transaction already
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO rename class to TransactionMeta
|
||||
@@ -27,7 +29,7 @@ TransactionMetaSet::TransactionMetaSet (uint256 const& txid, std::uint32_t ledge
|
||||
Serializer s (vec);
|
||||
SerializerIterator sit (s);
|
||||
|
||||
std::unique_ptr<SerializedType> pobj = STObject::deserialize (sit, sfMetadata);
|
||||
std::unique_ptr<STBase> pobj = STObject::deserialize (sit, sfMetadata);
|
||||
STObject* obj = static_cast<STObject*> (pobj.get ());
|
||||
|
||||
if (!obj)
|
||||
@@ -100,7 +102,7 @@ std::vector<RippleAddress> TransactionMetaSet::getAffectedAccounts ()
|
||||
|
||||
if (inner)
|
||||
{
|
||||
BOOST_FOREACH (const SerializedType & field, inner->peekData ())
|
||||
BOOST_FOREACH (const STBase & field, inner->peekData ())
|
||||
{
|
||||
const STAccount* sa = dynamic_cast<const STAccount*> (&field);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef RIPPLE_TRANSACTIONMETA_H
|
||||
#define RIPPLE_TRANSACTIONMETA_H
|
||||
|
||||
#include <ripple/app/misc/SerializedLedger.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
@@ -1318,8 +1318,8 @@ PeerImp::on_message (std::shared_ptr <protocol::TMTransaction> const& m)
|
||||
try
|
||||
{
|
||||
SerializerIterator sit (s);
|
||||
SerializedTransaction::pointer stx = std::make_shared <
|
||||
SerializedTransaction> (std::ref (sit));
|
||||
STTx::pointer stx = std::make_shared <
|
||||
STTx> (std::ref (sit));
|
||||
uint256 txID = stx->getTransactionID ();
|
||||
|
||||
int flags;
|
||||
@@ -1658,8 +1658,8 @@ PeerImp::on_message (std::shared_ptr <protocol::TMValidation> const& m)
|
||||
{
|
||||
Serializer s (m->validation ());
|
||||
SerializerIterator sit (s);
|
||||
SerializedValidation::pointer val = std::make_shared <
|
||||
SerializedValidation> (std::ref (sit), false);
|
||||
STValidation::pointer val = std::make_shared <
|
||||
STValidation> (std::ref (sit), false);
|
||||
|
||||
if (closeTime > (120 + val->getFieldU32(sfSigningTime)))
|
||||
{
|
||||
@@ -2477,7 +2477,7 @@ PeerImp::doProofOfWork (Job&, std::weak_ptr <PeerImp> peer,
|
||||
|
||||
void
|
||||
PeerImp::checkTransaction (Job&, int flags,
|
||||
SerializedTransaction::pointer stx, std::weak_ptr<PeerImp> peer)
|
||||
STTx::pointer stx, std::weak_ptr<PeerImp> peer)
|
||||
{
|
||||
// VFALCO TODO Rewrite to not use exceptions
|
||||
try
|
||||
@@ -2596,7 +2596,7 @@ PeerImp::checkPropose (Job& job, Overlay* pPeers,
|
||||
|
||||
void
|
||||
PeerImp::checkValidation (Job&, Overlay* pPeers,
|
||||
SerializedValidation::pointer val, bool isTrusted, bool isCluster,
|
||||
STValidation::pointer val, bool isTrusted, bool isCluster,
|
||||
std::shared_ptr<protocol::TMValidation> packet,
|
||||
std::weak_ptr<PeerImp> peer, beast::Journal journal)
|
||||
{
|
||||
@@ -2624,7 +2624,7 @@ PeerImp::checkValidation (Job&, Overlay* pPeers,
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
{
|
||||
SerializedValidation const& sv (*val);
|
||||
STValidation const& sv (*val);
|
||||
Validators::ReceivedValidation rv;
|
||||
rv.ledgerHash = sv.getLedgerHash ();
|
||||
rv.publicKey = sv.getSignerPublic();
|
||||
|
||||
@@ -531,7 +531,7 @@ private:
|
||||
doProofOfWork (Job&, std::weak_ptr <PeerImp> peer, ProofOfWork::pointer pow);
|
||||
|
||||
static
|
||||
void checkTransaction (Job&, int flags, SerializedTransaction::pointer stx,
|
||||
void checkTransaction (Job&, int flags, STTx::pointer stx,
|
||||
std::weak_ptr<PeerImp> peer);
|
||||
|
||||
// Called from our JobQueue
|
||||
@@ -545,7 +545,7 @@ private:
|
||||
|
||||
static
|
||||
void
|
||||
checkValidation (Job&, Overlay* pPeers, SerializedValidation::pointer val,
|
||||
checkValidation (Job&, Overlay* pPeers, STValidation::pointer val,
|
||||
bool isTrusted, bool isCluster,
|
||||
std::shared_ptr<protocol::TMValidation> packet,
|
||||
std::weak_ptr<PeerImp> peer, beast::Journal journal);
|
||||
|
||||
@@ -192,7 +192,7 @@ message TMHaveTransactionSet
|
||||
// Used to sign a final closed ledger after reprocessing
|
||||
message TMValidation
|
||||
{
|
||||
required bytes validation = 1; // in SerializedValidation signed form
|
||||
required bytes validation = 1; // in STValidation signed form
|
||||
optional bool checkedSignature = 2; // node vouches signature is correct
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/types/base_uint.h>
|
||||
#include <ripple/types/Book.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef RIPPLE_PROTOCOL_KNOWNFORMATS_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_KNOWNFORMATS_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SerializedObjectTemplate.h>
|
||||
#include <ripple/protocol/SOTemplate.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -2,3 +2,13 @@
|
||||
|
||||
Classes and functions for handling data and
|
||||
values associated with the Ripple protocol.
|
||||
|
||||
## Serialized Objects
|
||||
|
||||
In ripple objects transmitted over the network must be
|
||||
serialized into a canonical format. The prefix "ST" refers
|
||||
to classes that deal with the serialized format of ripple
|
||||
objects.
|
||||
|
||||
The term "Tx" or "tx" is an abbreviation for "Transaction",
|
||||
a commonly occurring object type.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/crypto/Base58Data.h>
|
||||
#include <ripple/crypto/ECDSACanonical.h>
|
||||
#include <ripple/types/UInt160.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/types/RippleAccountID.h>
|
||||
#include <ripple/types/RippleAccountPrivateKey.h>
|
||||
#include <ripple/types/RippleAccountPublicKey.h>
|
||||
|
||||
@@ -17,16 +17,15 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_SERIALIZEDOBJECTTEMPLATE_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SERIALIZEDOBJECTTEMPLATE_H_INCLUDED
|
||||
#ifndef RIPPLE_PROTOCOL_SOTEMPLATE_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SOTEMPLATE_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Flags for elements in a SerializedObjectTemplate.
|
||||
*/
|
||||
/** Flags for elements in a SOTemplate. */
|
||||
// VFALCO NOTE these don't look like bit-flags...
|
||||
enum SOE_Flags
|
||||
{
|
||||
@@ -38,8 +37,7 @@ enum SOE_Flags
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** An element in a SerializedObjectTemplate.
|
||||
*/
|
||||
/** An element in a SOTemplate. */
|
||||
class SOElement
|
||||
{
|
||||
public:
|
||||
@@ -55,7 +53,7 @@ public:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Defines the fields and their attributes within a SerializedObject.
|
||||
/** Defines the fields and their attributes within a STObject.
|
||||
Each subclass of SerializedObject will provide its own template
|
||||
describing the available fields and their metadata attributes.
|
||||
*/
|
||||
90
src/ripple/protocol/STAccount.h
Normal file
90
src/ripple/protocol/STAccount.h
Normal file
@@ -0,0 +1,90 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_STACCOUNT_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STACCOUNT_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STBlob.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class STAccount : public STBlob
|
||||
{
|
||||
public:
|
||||
STAccount (Blob const& v) : STBlob (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount (SField::ref n, Blob const& v) : STBlob (n, v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount (SField::ref n, Account const& v);
|
||||
STAccount (SField::ref n) : STBlob (n)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount ()
|
||||
{
|
||||
;
|
||||
}
|
||||
static std::unique_ptr<STBase> deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_ACCOUNT;
|
||||
}
|
||||
std::string getText () const;
|
||||
|
||||
RippleAddress getValueNCA () const;
|
||||
void setValueNCA (RippleAddress const& nca);
|
||||
|
||||
template <typename Tag>
|
||||
void setValueH160 (base_uint<160, Tag> const& v)
|
||||
{
|
||||
peekValue ().clear ();
|
||||
peekValue ().insert (peekValue ().end (), v.begin (), v.end ());
|
||||
assert (peekValue ().size () == (160 / 8));
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
bool getValueH160 (base_uint<160, Tag>& v) const
|
||||
{
|
||||
auto success = isValueH160 ();
|
||||
if (success)
|
||||
memcpy (v.begin (), & (peekValue ().front ()), (160 / 8));
|
||||
return success;
|
||||
}
|
||||
|
||||
bool isValueH160 () const;
|
||||
|
||||
private:
|
||||
virtual STAccount* duplicate () const
|
||||
{
|
||||
return new STAccount (*this);
|
||||
}
|
||||
static STAccount* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/types/Issue.h>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ripple {
|
||||
// Wire form:
|
||||
// High 8 bits are (offset+142), legal range is, 80 to 22 inclusive
|
||||
// Low 56 bits are value, legal range is 10^15 to (10^16 - 1) inclusive
|
||||
class STAmount : public SerializedType
|
||||
class STAmount : public STBase
|
||||
{
|
||||
public:
|
||||
typedef std::uint64_t mantissa_type;
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
createFromInt64 (SField::ref n, std::int64_t v);
|
||||
|
||||
static
|
||||
std::unique_ptr <SerializedType>
|
||||
std::unique_ptr <STBase>
|
||||
deserialize (
|
||||
SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// SerializedType
|
||||
// STBase
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
add (Serializer& s) const override;
|
||||
|
||||
bool
|
||||
isEquivalent (const SerializedType& t) const override;
|
||||
isEquivalent (const STBase& t) const override;
|
||||
|
||||
bool
|
||||
isDefault() const override
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace ripple {
|
||||
|
||||
class STArray final
|
||||
: public SerializedType
|
||||
: public STBase
|
||||
, public CountedObject <STArray>
|
||||
{
|
||||
public:
|
||||
@@ -50,15 +50,15 @@ public:
|
||||
{
|
||||
value.reserve (n);
|
||||
}
|
||||
explicit STArray (SField::ref f) : SerializedType (f)
|
||||
explicit STArray (SField::ref f) : STBase (f)
|
||||
{
|
||||
;
|
||||
}
|
||||
STArray (SField::ref f, int n) : SerializedType (f)
|
||||
STArray (SField::ref f, int n) : STBase (f)
|
||||
{
|
||||
value.reserve (n);
|
||||
}
|
||||
STArray (SField::ref f, const vector & v) : SerializedType (f), value (v)
|
||||
STArray (SField::ref f, const vector & v) : STBase (f), value (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
virtual ~STArray () { }
|
||||
|
||||
static std::unique_ptr<SerializedType>
|
||||
static std::unique_ptr<STBase>
|
||||
deserialize (SerializerIterator & sit, SField::ref name);
|
||||
|
||||
const vector& getValue () const
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
{
|
||||
return STI_ARRAY;
|
||||
}
|
||||
virtual bool isEquivalent (const SerializedType & t) const override;
|
||||
virtual bool isEquivalent (const STBase & t) const override;
|
||||
virtual bool isDefault () const override
|
||||
{
|
||||
return value.empty ();
|
||||
|
||||
162
src/ripple/protocol/STBase.h
Normal file
162
src/ripple/protocol/STBase.h
Normal file
@@ -0,0 +1,162 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_STBASE_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STBASE_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO fix this restriction on copy assignment.
|
||||
//
|
||||
// CAUTION: Do not create a vector (or similar container) of any object derived
|
||||
// from STBase. Use Boost ptr_* containers. The copy assignment operator
|
||||
// of STBase has semantics that will cause contained types to change
|
||||
// their names when an object is deleted because copy assignment is used to
|
||||
// "slide down" the remaining types and this will not copy the field
|
||||
// name. Changing the copy assignment operator to copy the field name breaks the
|
||||
// use of copy assignment just to copy values, which is used in the transaction
|
||||
// engine code.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** A type which can be exported to a well known binary format.
|
||||
|
||||
A STBase:
|
||||
- Always a field
|
||||
- Can always go inside an eligible enclosing STBase
|
||||
(such as STArray)
|
||||
- Has a field name
|
||||
|
||||
Like JSON, a SerializedObject is a basket which has rules
|
||||
on what it can hold.
|
||||
|
||||
@note "ST" stands for "Serialized Type."
|
||||
*/
|
||||
class STBase
|
||||
{
|
||||
public:
|
||||
STBase();
|
||||
|
||||
explicit
|
||||
STBase (SField::ref n);
|
||||
|
||||
virtual ~STBase() = default;
|
||||
|
||||
STBase& operator= (const STBase& t);
|
||||
|
||||
bool operator== (const STBase& t) const;
|
||||
bool operator!= (const STBase& t) const;
|
||||
|
||||
template <class D>
|
||||
D&
|
||||
downcast()
|
||||
{
|
||||
D* ptr = dynamic_cast<D*> (this);
|
||||
if (ptr == nullptr)
|
||||
throw std::bad_cast();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
template <class D>
|
||||
D const&
|
||||
downcast() const
|
||||
{
|
||||
D const * ptr = dynamic_cast<D const*> (this);
|
||||
if (ptr == nullptr)
|
||||
throw std::bad_cast();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
virtual
|
||||
SerializedTypeID
|
||||
getSType() const;
|
||||
|
||||
virtual
|
||||
std::string
|
||||
getFullText() const;
|
||||
|
||||
virtual
|
||||
std::string
|
||||
getText() const;
|
||||
|
||||
virtual
|
||||
Json::Value
|
||||
getJson (int /*options*/) const;
|
||||
|
||||
virtual
|
||||
void
|
||||
add (Serializer& s) const;
|
||||
|
||||
virtual
|
||||
bool
|
||||
isEquivalent (STBase const& t) const;
|
||||
|
||||
virtual
|
||||
bool
|
||||
isDefault() const;
|
||||
|
||||
/** A STBase is a field.
|
||||
This sets the name.
|
||||
*/
|
||||
void
|
||||
setFName (SField::ref n);
|
||||
|
||||
SField::ref
|
||||
getFName() const;
|
||||
|
||||
std::unique_ptr<STBase>
|
||||
clone() const;
|
||||
|
||||
void
|
||||
addFieldID (Serializer& s) const;
|
||||
|
||||
static
|
||||
std::unique_ptr <STBase>
|
||||
deserialize (SField::ref name);
|
||||
|
||||
protected:
|
||||
SField::ptr fName;
|
||||
|
||||
private:
|
||||
// VFALCO TODO Return std::unique_ptr <STBase>
|
||||
virtual
|
||||
STBase*
|
||||
duplicate() const
|
||||
{
|
||||
return new STBase (*fName);
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
STBase* new_clone (const STBase& s);
|
||||
|
||||
void delete_clone (const STBase* s);
|
||||
|
||||
std::ostream& operator<< (std::ostream& out, const STBase& t);
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -20,39 +20,39 @@
|
||||
#ifndef RIPPLE_PROTOCOL_STBITS_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STBITS_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
template <std::size_t Bits>
|
||||
class STBitString : public SerializedType
|
||||
class STBitString : public STBase
|
||||
{
|
||||
public:
|
||||
typedef base_uint<Bits> BitString;
|
||||
|
||||
STBitString () {}
|
||||
STBitString (SField::ref n) : SerializedType (n) {}
|
||||
STBitString (SField::ref n) : STBase (n) {}
|
||||
STBitString (const BitString& v) : bitString_ (v) {}
|
||||
|
||||
STBitString (SField::ref n, const BitString& v)
|
||||
: SerializedType (n), bitString_ (v)
|
||||
: STBase (n), bitString_ (v)
|
||||
{
|
||||
}
|
||||
|
||||
STBitString (SField::ref n, const char* v) : SerializedType (n)
|
||||
STBitString (SField::ref n, const char* v) : STBase (n)
|
||||
{
|
||||
bitString_.SetHex (v);
|
||||
}
|
||||
|
||||
STBitString (SField::ref n, std::string const& v) : SerializedType (n)
|
||||
STBitString (SField::ref n, std::string const& v) : STBase (n)
|
||||
{
|
||||
bitString_.SetHex (v);
|
||||
}
|
||||
|
||||
static std::unique_ptr<SerializedType> deserialize (
|
||||
static std::unique_ptr<STBase> deserialize (
|
||||
SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
SerializedTypeID getSType () const;
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
return to_string (bitString_);
|
||||
}
|
||||
|
||||
bool isEquivalent (const SerializedType& t) const
|
||||
bool isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STBitString* v = dynamic_cast<const STBitString*> (&t);
|
||||
return v && (bitString_ == v->bitString_);
|
||||
|
||||
106
src/ripple/protocol/STBlob.h
Normal file
106
src/ripple/protocol/STBlob.h
Normal file
@@ -0,0 +1,106 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_STBLOB_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STBLOB_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// variable length byte string
|
||||
class STBlob : public STBase
|
||||
{
|
||||
public:
|
||||
STBlob (Blob const& v) : value (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STBlob (SField::ref n, Blob const& v) : STBase (n), value (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STBlob (SField::ref n) : STBase (n)
|
||||
{
|
||||
;
|
||||
}
|
||||
STBlob (SerializerIterator&, SField::ref name = sfGeneric);
|
||||
STBlob ()
|
||||
{
|
||||
;
|
||||
}
|
||||
static std::unique_ptr<STBase> deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
virtual SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_VL;
|
||||
}
|
||||
virtual std::string getText () const;
|
||||
void add (Serializer& s) const
|
||||
{
|
||||
assert (fName->isBinary ());
|
||||
assert ((fName->fieldType == STI_VL) ||
|
||||
(fName->fieldType == STI_ACCOUNT));
|
||||
s.addVL (value);
|
||||
}
|
||||
|
||||
Blob const& peekValue () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
Blob& peekValue ()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
Blob getValue () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
void setValue (Blob const& v)
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
operator Blob () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
virtual bool isEquivalent (const STBase& t) const;
|
||||
virtual bool isDefault () const
|
||||
{
|
||||
return value.empty ();
|
||||
}
|
||||
|
||||
private:
|
||||
Blob value;
|
||||
|
||||
virtual STBlob* duplicate () const
|
||||
{
|
||||
return new STBlob (*this);
|
||||
}
|
||||
static STBlob* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -20,26 +20,26 @@
|
||||
#ifndef RIPPLE_PROTOCOL_STINTEGER_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STINTEGER_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
template <typename Integer>
|
||||
class STInteger : public SerializedType
|
||||
class STInteger : public STBase
|
||||
{
|
||||
public:
|
||||
explicit STInteger (Integer v) : value_ (v)
|
||||
{
|
||||
}
|
||||
|
||||
STInteger (SField::ref n, Integer v = 0) : SerializedType (n), value_ (v)
|
||||
STInteger (SField::ref n, Integer v = 0) : STBase (n), value_ (v)
|
||||
{
|
||||
}
|
||||
|
||||
static std::unique_ptr<SerializedType> deserialize (
|
||||
static std::unique_ptr<STBase> deserialize (
|
||||
SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
return value_ == 0;
|
||||
}
|
||||
|
||||
bool isEquivalent (const SerializedType& t) const
|
||||
bool isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STInteger* v = dynamic_cast<const STInteger*> (&t);
|
||||
return v && (value_ == v->value_);
|
||||
|
||||
@@ -17,44 +17,29 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SERIALIZEDLEDGER_H
|
||||
#define RIPPLE_SERIALIZEDLEDGER_H
|
||||
#ifndef RIPPLE_PROTOCOL_STLEDGERENTRY_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STLEDGERENTRY_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/STObject.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO NOTE
|
||||
//
|
||||
// This looks like a central class for Ripple. Almost everything that
|
||||
// does anything of interest deals with SLE objects. Any documentation
|
||||
// effort should start with a complete description of this object and
|
||||
// all of its operations.
|
||||
//
|
||||
// It is derived from STObject so it inherits a lot of behavior from that.
|
||||
//
|
||||
// VFALCO TODO Rename the source file to match the class
|
||||
//
|
||||
// VFALCO TODO Can we rename this class to something shorter and more concise?
|
||||
//
|
||||
// Can we just call this LedgerEntry?
|
||||
//
|
||||
class SerializedLedgerEntry
|
||||
class STLedgerEntry
|
||||
: public STObject
|
||||
, public CountedObject <SerializedLedgerEntry>
|
||||
, public CountedObject <STLedgerEntry>
|
||||
{
|
||||
public:
|
||||
static char const* getCountedObjectName () { return "SerializedLedgerEntry"; }
|
||||
static char const* getCountedObjectName () { return "STLedgerEntry"; }
|
||||
|
||||
typedef std::shared_ptr<SerializedLedgerEntry> pointer;
|
||||
typedef const std::shared_ptr<SerializedLedgerEntry>& ref;
|
||||
typedef std::shared_ptr<STLedgerEntry> pointer;
|
||||
typedef const std::shared_ptr<STLedgerEntry>& ref;
|
||||
|
||||
public:
|
||||
SerializedLedgerEntry (const Serializer & s, uint256 const& index);
|
||||
SerializedLedgerEntry (SerializerIterator & sit, uint256 const& index);
|
||||
SerializedLedgerEntry (LedgerEntryType type, uint256 const& index);
|
||||
SerializedLedgerEntry (const STObject & object, uint256 const& index);
|
||||
STLedgerEntry (const Serializer & s, uint256 const& index);
|
||||
STLedgerEntry (SerializerIterator & sit, uint256 const& index);
|
||||
STLedgerEntry (LedgerEntryType type, uint256 const& index);
|
||||
STLedgerEntry (const STObject & object, uint256 const& index);
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
{
|
||||
@@ -81,7 +66,7 @@ public:
|
||||
{
|
||||
return mMutable;
|
||||
}
|
||||
SerializedLedgerEntry::pointer getMutable () const;
|
||||
STLedgerEntry::pointer getMutable () const;
|
||||
|
||||
LedgerEntryType getType () const
|
||||
{
|
||||
@@ -110,9 +95,9 @@ public:
|
||||
std::vector<uint256> getOwners (); // nodes notified if this node is deleted
|
||||
|
||||
private:
|
||||
SerializedLedgerEntry* duplicate () const
|
||||
STLedgerEntry* duplicate () const
|
||||
{
|
||||
return new SerializedLedgerEntry (*this);
|
||||
return new STLedgerEntry (*this);
|
||||
}
|
||||
|
||||
/** Make STObject comply with the template for this SLE type
|
||||
@@ -127,7 +112,7 @@ private:
|
||||
bool mMutable;
|
||||
};
|
||||
|
||||
typedef SerializedLedgerEntry SLE;
|
||||
using SLE = STLedgerEntry;
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
#include <ripple/basics/CountedObject.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/SerializedTypes.h>
|
||||
#include <ripple/protocol/SerializedObjectTemplate.h>
|
||||
#include <ripple/protocol/STPathSet.h>
|
||||
#include <ripple/protocol/STVector256.h>
|
||||
#include <ripple/protocol/SOTemplate.h>
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -32,7 +32,7 @@ namespace ripple {
|
||||
class STArray;
|
||||
|
||||
class STObject
|
||||
: public SerializedType
|
||||
: public STBase
|
||||
, public CountedObject <STObject>
|
||||
{
|
||||
public:
|
||||
@@ -44,27 +44,27 @@ public:
|
||||
}
|
||||
|
||||
explicit STObject (SField::ref name)
|
||||
: SerializedType (name), mType (nullptr)
|
||||
: STBase (name), mType (nullptr)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
STObject (const SOTemplate & type, SField::ref name)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
{
|
||||
set (type);
|
||||
}
|
||||
|
||||
STObject (
|
||||
const SOTemplate & type, SerializerIterator & sit, SField::ref name)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
{
|
||||
set (sit);
|
||||
setType (type);
|
||||
}
|
||||
|
||||
STObject (SField::ref name, boost::ptr_vector<SerializedType>& data)
|
||||
: SerializedType (name), mType (nullptr)
|
||||
STObject (SField::ref name, boost::ptr_vector<STBase>& data)
|
||||
: STBase (name), mType (nullptr)
|
||||
{
|
||||
mData.swap (data);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
virtual ~STObject () { }
|
||||
|
||||
static std::unique_ptr<SerializedType>
|
||||
static std::unique_ptr<STBase>
|
||||
deserialize (SerializerIterator & sit, SField::ref name);
|
||||
|
||||
bool setType (const SOTemplate & type);
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
{
|
||||
return STI_OBJECT;
|
||||
}
|
||||
virtual bool isEquivalent (const SerializedType & t) const override;
|
||||
virtual bool isEquivalent (const STBase & t) const override;
|
||||
virtual bool isDefault () const override
|
||||
{
|
||||
return mData.empty ();
|
||||
@@ -123,42 +123,42 @@ public:
|
||||
// TODO(tom): options should be an enum.
|
||||
virtual Json::Value getJson (int options) const override;
|
||||
|
||||
int addObject (const SerializedType & t)
|
||||
int addObject (const STBase & t)
|
||||
{
|
||||
mData.push_back (t.clone ().release ());
|
||||
return mData.size () - 1;
|
||||
}
|
||||
int giveObject (std::unique_ptr<SerializedType> t)
|
||||
int giveObject (std::unique_ptr<STBase> t)
|
||||
{
|
||||
mData.push_back (t.release ());
|
||||
return mData.size () - 1;
|
||||
}
|
||||
int giveObject (SerializedType * t)
|
||||
int giveObject (STBase * t)
|
||||
{
|
||||
mData.push_back (t);
|
||||
return mData.size () - 1;
|
||||
}
|
||||
const boost::ptr_vector<SerializedType>& peekData () const
|
||||
const boost::ptr_vector<STBase>& peekData () const
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
boost::ptr_vector<SerializedType>& peekData ()
|
||||
boost::ptr_vector<STBase>& peekData ()
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
SerializedType& front ()
|
||||
STBase& front ()
|
||||
{
|
||||
return mData.front ();
|
||||
}
|
||||
const SerializedType& front () const
|
||||
const STBase& front () const
|
||||
{
|
||||
return mData.front ();
|
||||
}
|
||||
SerializedType& back ()
|
||||
STBase& back ()
|
||||
{
|
||||
return mData.back ();
|
||||
}
|
||||
const SerializedType& back () const
|
||||
const STBase& back () const
|
||||
{
|
||||
return mData.back ();
|
||||
}
|
||||
@@ -176,19 +176,19 @@ public:
|
||||
uint256 getHash (std::uint32_t prefix) const;
|
||||
uint256 getSigningHash (std::uint32_t prefix) const;
|
||||
|
||||
const SerializedType& peekAtIndex (int offset) const
|
||||
const STBase& peekAtIndex (int offset) const
|
||||
{
|
||||
return mData[offset];
|
||||
}
|
||||
SerializedType& getIndex (int offset)
|
||||
STBase& getIndex (int offset)
|
||||
{
|
||||
return mData[offset];
|
||||
}
|
||||
const SerializedType* peekAtPIndex (int offset) const
|
||||
const STBase* peekAtPIndex (int offset) const
|
||||
{
|
||||
return & (mData[offset]);
|
||||
}
|
||||
SerializedType* getPIndex (int offset)
|
||||
STBase* getPIndex (int offset)
|
||||
{
|
||||
return & (mData[offset]);
|
||||
}
|
||||
@@ -196,10 +196,10 @@ public:
|
||||
int getFieldIndex (SField::ref field) const;
|
||||
SField::ref getFieldSType (int index) const;
|
||||
|
||||
const SerializedType& peekAtField (SField::ref field) const;
|
||||
SerializedType& getField (SField::ref field);
|
||||
const SerializedType* peekAtPField (SField::ref field) const;
|
||||
SerializedType* getPField (SField::ref field, bool createOkay = false);
|
||||
const STBase& peekAtField (SField::ref field) const;
|
||||
STBase& getField (SField::ref field);
|
||||
const STBase* peekAtPField (SField::ref field) const;
|
||||
STBase* getPField (SField::ref field, bool createOkay = false);
|
||||
|
||||
// these throw if the field type doesn't match, or return default values
|
||||
// if the field is optional but not present
|
||||
@@ -241,7 +241,7 @@ public:
|
||||
template <class Tag>
|
||||
void setFieldH160 (SField::ref field, base_uint<160, Tag> const& v)
|
||||
{
|
||||
SerializedType* rf = getPField (field, true);
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -259,35 +259,35 @@ public:
|
||||
STObject& peekFieldObject (SField::ref field);
|
||||
|
||||
bool isFieldPresent (SField::ref field) const;
|
||||
SerializedType* makeFieldPresent (SField::ref field);
|
||||
STBase* makeFieldPresent (SField::ref field);
|
||||
void makeFieldAbsent (SField::ref field);
|
||||
bool delField (SField::ref field);
|
||||
void delField (int index);
|
||||
|
||||
static std::unique_ptr <SerializedType>
|
||||
static std::unique_ptr <STBase>
|
||||
makeDefaultObject (SerializedTypeID id, SField::ref name);
|
||||
|
||||
// VFALCO TODO remove the 'depth' parameter
|
||||
static std::unique_ptr<SerializedType> makeDeserializedObject (
|
||||
static std::unique_ptr<STBase> makeDeserializedObject (
|
||||
SerializedTypeID id,
|
||||
SField::ref name,
|
||||
SerializerIterator&,
|
||||
int depth);
|
||||
|
||||
static std::unique_ptr<SerializedType>
|
||||
static std::unique_ptr<STBase>
|
||||
makeNonPresentObject (SField::ref name)
|
||||
{
|
||||
return makeDefaultObject (STI_NOTPRESENT, name);
|
||||
}
|
||||
|
||||
static std::unique_ptr<SerializedType> makeDefaultObject (SField::ref name)
|
||||
static std::unique_ptr<STBase> makeDefaultObject (SField::ref name)
|
||||
{
|
||||
return makeDefaultObject (name.fieldType, name);
|
||||
}
|
||||
|
||||
// field iterator stuff
|
||||
typedef boost::ptr_vector<SerializedType>::iterator iterator;
|
||||
typedef boost::ptr_vector<SerializedType>::const_iterator const_iterator;
|
||||
typedef boost::ptr_vector<STBase>::iterator iterator;
|
||||
typedef boost::ptr_vector<STBase>::const_iterator const_iterator;
|
||||
iterator begin ()
|
||||
{
|
||||
return mData.begin ();
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
return mData.empty ();
|
||||
}
|
||||
|
||||
bool hasMatchingEntry (const SerializedType&);
|
||||
bool hasMatchingEntry (const STBase&);
|
||||
|
||||
bool operator== (const STObject & o) const;
|
||||
bool operator!= (const STObject & o) const
|
||||
@@ -333,7 +333,7 @@ private:
|
||||
decltype (std::declval <T> ().getValue ())>::type >::type >
|
||||
V getFieldByValue (SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField (field);
|
||||
const STBase* rf = peekAtPField (field);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -359,7 +359,7 @@ private:
|
||||
template <typename T, typename V>
|
||||
V const& getFieldByConstRef (SField::ref field, V const& empty) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField (field);
|
||||
const STBase* rf = peekAtPField (field);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -381,7 +381,7 @@ private:
|
||||
template <typename T, typename V>
|
||||
void setFieldUsingSetValue (SField::ref field, V value)
|
||||
{
|
||||
SerializedType* rf = getPField (field, true);
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -401,7 +401,7 @@ private:
|
||||
template <typename T>
|
||||
void setFieldUsingAssignment (SField::ref field, T const& value)
|
||||
{
|
||||
SerializedType* rf = getPField (field, true);
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -418,7 +418,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
boost::ptr_vector<SerializedType> mData;
|
||||
boost::ptr_vector<STBase> mData;
|
||||
const SOTemplate* mType;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,162 +17,14 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_SERIALIZEDTYPES_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SERIALIZEDTYPES_H_INCLUDED
|
||||
#ifndef RIPPLE_PROTOCOL_STPATHELEMENT_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_STPATHELEMENT_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/protocol/STBitString.h>
|
||||
#include <ripple/protocol/STInteger.h>
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// variable length byte string
|
||||
class STVariableLength : public SerializedType
|
||||
{
|
||||
public:
|
||||
STVariableLength (Blob const& v) : value (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STVariableLength (SField::ref n, Blob const& v) : SerializedType (n), value (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STVariableLength (SField::ref n) : SerializedType (n)
|
||||
{
|
||||
;
|
||||
}
|
||||
STVariableLength (SerializerIterator&, SField::ref name = sfGeneric);
|
||||
STVariableLength ()
|
||||
{
|
||||
;
|
||||
}
|
||||
static std::unique_ptr<SerializedType> deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
}
|
||||
|
||||
virtual SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_VL;
|
||||
}
|
||||
virtual std::string getText () const;
|
||||
void add (Serializer& s) const
|
||||
{
|
||||
assert (fName->isBinary ());
|
||||
assert ((fName->fieldType == STI_VL) ||
|
||||
(fName->fieldType == STI_ACCOUNT));
|
||||
s.addVL (value);
|
||||
}
|
||||
|
||||
Blob const& peekValue () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
Blob& peekValue ()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
Blob getValue () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
void setValue (Blob const& v)
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
operator Blob () const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
virtual bool isEquivalent (const SerializedType& t) const;
|
||||
virtual bool isDefault () const
|
||||
{
|
||||
return value.empty ();
|
||||
}
|
||||
|
||||
private:
|
||||
Blob value;
|
||||
|
||||
virtual STVariableLength* duplicate () const
|
||||
{
|
||||
return new STVariableLength (*this);
|
||||
}
|
||||
static STVariableLength* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class STAccount : public STVariableLength
|
||||
{
|
||||
public:
|
||||
STAccount (Blob const& v) : STVariableLength (v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount (SField::ref n, Blob const& v) : STVariableLength (n, v)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount (SField::ref n, Account const& v);
|
||||
STAccount (SField::ref n) : STVariableLength (n)
|
||||
{
|
||||
;
|
||||
}
|
||||
STAccount ()
|
||||
{
|
||||
;
|
||||
}
|
||||
static std::unique_ptr<SerializedType> deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
}
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_ACCOUNT;
|
||||
}
|
||||
std::string getText () const;
|
||||
|
||||
RippleAddress getValueNCA () const;
|
||||
void setValueNCA (RippleAddress const& nca);
|
||||
|
||||
template <typename Tag>
|
||||
void setValueH160 (base_uint<160, Tag> const& v)
|
||||
{
|
||||
peekValue ().clear ();
|
||||
peekValue ().insert (peekValue ().end (), v.begin (), v.end ());
|
||||
assert (peekValue ().size () == (160 / 8));
|
||||
}
|
||||
|
||||
template <typename Tag>
|
||||
bool getValueH160 (base_uint<160, Tag>& v) const
|
||||
{
|
||||
auto success = isValueH160 ();
|
||||
if (success)
|
||||
memcpy (v.begin (), & (peekValue ().front ()), (160 / 8));
|
||||
return success;
|
||||
}
|
||||
|
||||
bool isValueH160 () const;
|
||||
|
||||
private:
|
||||
virtual STAccount* duplicate () const
|
||||
{
|
||||
return new STAccount (*this);
|
||||
}
|
||||
static STAccount* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO Why isn't this derived from STBase?
|
||||
class STPathElement
|
||||
{
|
||||
public:
|
||||
@@ -273,8 +125,6 @@ private:
|
||||
std::size_t hash_value_;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class STPath
|
||||
{
|
||||
public:
|
||||
@@ -348,20 +198,20 @@ private:
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// A set of zero or more payment paths
|
||||
class STPathSet : public SerializedType
|
||||
class STPathSet : public STBase
|
||||
{
|
||||
public:
|
||||
STPathSet () = default;
|
||||
|
||||
STPathSet (SField::ref n)
|
||||
: SerializedType (n)
|
||||
: STBase (n)
|
||||
{ }
|
||||
|
||||
static
|
||||
std::unique_ptr<SerializedType>
|
||||
std::unique_ptr<STBase>
|
||||
deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
void add (Serializer& s) const;
|
||||
@@ -407,7 +257,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool isEquivalent (const SerializedType& t) const;
|
||||
virtual bool isEquivalent (const STBase& t) const;
|
||||
virtual bool isDefault () const
|
||||
{
|
||||
return value.empty ();
|
||||
@@ -433,7 +283,7 @@ private:
|
||||
std::vector<STPath> value;
|
||||
|
||||
STPathSet (SField::ref n, const std::vector<STPath>& v)
|
||||
: SerializedType (n), value (v)
|
||||
: STBase (n), value (v)
|
||||
{ }
|
||||
|
||||
STPathSet* duplicate () const
|
||||
@@ -446,104 +296,6 @@ private:
|
||||
construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class STVector256 : public SerializedType
|
||||
{
|
||||
public:
|
||||
STVector256 () = default;
|
||||
explicit STVector256 (SField::ref n)
|
||||
: SerializedType (n)
|
||||
{ }
|
||||
explicit STVector256 (std::vector<uint256> const& vector)
|
||||
: mValue (vector)
|
||||
{ }
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_VECTOR256;
|
||||
}
|
||||
void add (Serializer& s) const;
|
||||
|
||||
static
|
||||
std::unique_ptr<SerializedType>
|
||||
deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (construct (sit, name));
|
||||
}
|
||||
|
||||
const std::vector<uint256>&
|
||||
peekValue () const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
std::vector<uint256>&
|
||||
peekValue ()
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
virtual bool isEquivalent (const SerializedType& t) const;
|
||||
virtual bool isDefault () const
|
||||
{
|
||||
return mValue.empty ();
|
||||
}
|
||||
|
||||
std::vector<uint256>::size_type
|
||||
size () const
|
||||
{
|
||||
return mValue.size ();
|
||||
}
|
||||
bool empty () const
|
||||
{
|
||||
return mValue.empty ();
|
||||
}
|
||||
|
||||
std::vector<uint256>::const_reference
|
||||
operator[] (std::vector<uint256>::size_type n) const
|
||||
{
|
||||
return mValue[n];
|
||||
}
|
||||
|
||||
void setValue (const STVector256& v)
|
||||
{
|
||||
mValue = v.mValue;
|
||||
}
|
||||
|
||||
void push_back (uint256 const& v)
|
||||
{
|
||||
mValue.push_back (v);
|
||||
}
|
||||
|
||||
void sort ()
|
||||
{
|
||||
std::sort (mValue.begin (), mValue.end ());
|
||||
}
|
||||
|
||||
Json::Value getJson (int) const;
|
||||
|
||||
std::vector<uint256>::const_iterator
|
||||
begin() const
|
||||
{
|
||||
return mValue.begin ();
|
||||
}
|
||||
std::vector<uint256>::const_iterator
|
||||
end() const
|
||||
{
|
||||
return mValue.end ();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint256> mValue;
|
||||
|
||||
STVector256* duplicate () const
|
||||
{
|
||||
return new STVector256 (*this);
|
||||
}
|
||||
static STVector256* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -34,27 +34,27 @@ namespace ripple {
|
||||
#define TXN_SQL_INCLUDED 'I'
|
||||
#define TXN_SQL_UNKNOWN 'U'
|
||||
|
||||
class SerializedTransaction
|
||||
class STTx
|
||||
: public STObject
|
||||
, public CountedObject <SerializedTransaction>
|
||||
, public CountedObject <STTx>
|
||||
{
|
||||
public:
|
||||
static char const* getCountedObjectName () { return "SerializedTransaction"; }
|
||||
static char const* getCountedObjectName () { return "STTx"; }
|
||||
|
||||
typedef std::shared_ptr<SerializedTransaction> pointer;
|
||||
typedef const std::shared_ptr<SerializedTransaction>& ref;
|
||||
typedef std::shared_ptr<STTx> pointer;
|
||||
typedef const std::shared_ptr<STTx>& ref;
|
||||
|
||||
public:
|
||||
SerializedTransaction () = delete;
|
||||
SerializedTransaction& operator= (SerializedTransaction const& other) = delete;
|
||||
STTx () = delete;
|
||||
STTx& operator= (STTx const& other) = delete;
|
||||
|
||||
SerializedTransaction (SerializedTransaction const& other) = default;
|
||||
STTx (STTx const& other) = default;
|
||||
|
||||
explicit SerializedTransaction (SerializerIterator& sit);
|
||||
explicit SerializedTransaction (TxType type);
|
||||
explicit STTx (SerializerIterator& sit);
|
||||
explicit STTx (TxType type);
|
||||
|
||||
// Only called from ripple::RPC::transactionSign - can we eliminate this?
|
||||
explicit SerializedTransaction (STObject const& object);
|
||||
explicit STTx (STObject const& object);
|
||||
|
||||
// STObject functions
|
||||
SerializedTypeID getSType () const
|
||||
@@ -145,9 +145,9 @@ public:
|
||||
std::string const& escapedMetaData) const;
|
||||
|
||||
private:
|
||||
SerializedTransaction* duplicate () const override
|
||||
STTx* duplicate () const override
|
||||
{
|
||||
return new SerializedTransaction (*this);
|
||||
return new STTx (*this);
|
||||
}
|
||||
|
||||
TxType tx_type_;
|
||||
@@ -25,15 +25,15 @@ namespace ripple {
|
||||
// Validation flags
|
||||
const std::uint32_t vfFullyCanonicalSig = 0x80000000; // signature is fully canonical
|
||||
|
||||
class SerializedValidation
|
||||
class STValidation
|
||||
: public STObject
|
||||
, public CountedObject <SerializedValidation>
|
||||
, public CountedObject <STValidation>
|
||||
{
|
||||
public:
|
||||
static char const* getCountedObjectName () { return "SerializedValidation"; }
|
||||
static char const* getCountedObjectName () { return "STValidation"; }
|
||||
|
||||
typedef std::shared_ptr<SerializedValidation> pointer;
|
||||
typedef const std::shared_ptr<SerializedValidation>& ref;
|
||||
typedef std::shared_ptr<STValidation> pointer;
|
||||
typedef const std::shared_ptr<STValidation>& ref;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -41,10 +41,10 @@ public:
|
||||
};
|
||||
|
||||
// These throw if the object is not valid
|
||||
SerializedValidation (SerializerIterator & sit, bool checkSignature = true);
|
||||
STValidation (SerializerIterator & sit, bool checkSignature = true);
|
||||
|
||||
// Does not sign the validation
|
||||
SerializedValidation (uint256 const& ledgerHash, std::uint32_t signTime,
|
||||
STValidation (uint256 const& ledgerHash, std::uint32_t signTime,
|
||||
const RippleAddress & raPub, bool isFull);
|
||||
|
||||
uint256 getLedgerHash () const;
|
||||
128
src/ripple/protocol/STVector256.h
Normal file
128
src/ripple/protocol/STVector256.h
Normal file
@@ -0,0 +1,128 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_SERIALIZEDTYPES_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SERIALIZEDTYPES_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STBitString.h>
|
||||
#include <ripple/protocol/STInteger.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class STVector256 : public STBase
|
||||
{
|
||||
public:
|
||||
STVector256 () = default;
|
||||
explicit STVector256 (SField::ref n)
|
||||
: STBase (n)
|
||||
{ }
|
||||
explicit STVector256 (std::vector<uint256> const& vector)
|
||||
: mValue (vector)
|
||||
{ }
|
||||
|
||||
SerializedTypeID getSType () const
|
||||
{
|
||||
return STI_VECTOR256;
|
||||
}
|
||||
void add (Serializer& s) const;
|
||||
|
||||
static
|
||||
std::unique_ptr<STBase>
|
||||
deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<STBase> (construct (sit, name));
|
||||
}
|
||||
|
||||
const std::vector<uint256>&
|
||||
peekValue () const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
std::vector<uint256>&
|
||||
peekValue ()
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
virtual bool isEquivalent (const STBase& t) const;
|
||||
virtual bool isDefault () const
|
||||
{
|
||||
return mValue.empty ();
|
||||
}
|
||||
|
||||
std::vector<uint256>::size_type
|
||||
size () const
|
||||
{
|
||||
return mValue.size ();
|
||||
}
|
||||
bool empty () const
|
||||
{
|
||||
return mValue.empty ();
|
||||
}
|
||||
|
||||
std::vector<uint256>::const_reference
|
||||
operator[] (std::vector<uint256>::size_type n) const
|
||||
{
|
||||
return mValue[n];
|
||||
}
|
||||
|
||||
void setValue (const STVector256& v)
|
||||
{
|
||||
mValue = v.mValue;
|
||||
}
|
||||
|
||||
void push_back (uint256 const& v)
|
||||
{
|
||||
mValue.push_back (v);
|
||||
}
|
||||
|
||||
void sort ()
|
||||
{
|
||||
std::sort (mValue.begin (), mValue.end ());
|
||||
}
|
||||
|
||||
Json::Value getJson (int) const;
|
||||
|
||||
std::vector<uint256>::const_iterator
|
||||
begin() const
|
||||
{
|
||||
return mValue.begin ();
|
||||
}
|
||||
std::vector<uint256>::const_iterator
|
||||
end() const
|
||||
{
|
||||
return mValue.end ();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint256> mValue;
|
||||
|
||||
STVector256* duplicate () const
|
||||
{
|
||||
return new STVector256 (*this);
|
||||
}
|
||||
static STVector256* construct (SerializerIterator&, SField::ref);
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -1,236 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_PROTOCOL_SERIALIZEDTYPE_H_INCLUDED
|
||||
#define RIPPLE_PROTOCOL_SERIALIZEDTYPE_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO TODO fix this restriction on copy assignment.
|
||||
//
|
||||
// CAUTION: Do not create a vector (or similar container) of any object derived
|
||||
// from SerializedType. Use Boost ptr_* containers. The copy assignment operator
|
||||
// of SerializedType has semantics that will cause contained types to change
|
||||
// their names when an object is deleted because copy assignment is used to
|
||||
// "slide down" the remaining types and this will not copy the field
|
||||
// name. Changing the copy assignment operator to copy the field name breaks the
|
||||
// use of copy assignment just to copy values, which is used in the transaction
|
||||
// engine code.
|
||||
|
||||
// VFALCO TODO Remove this unused enum
|
||||
/*
|
||||
enum PathFlags
|
||||
{
|
||||
PF_END = 0x00, // End of current path & path list.
|
||||
PF_BOUNDARY = 0xFF, // End of current path & new path follows.
|
||||
|
||||
PF_ACCOUNT = 0x01,
|
||||
PF_OFFER = 0x02,
|
||||
|
||||
PF_WANTED_CURRENCY = 0x10,
|
||||
PF_WANTED_ISSUER = 0x20,
|
||||
PF_REDEEM = 0x40,
|
||||
PF_ISSUE = 0x80,
|
||||
};
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** A type which can be exported to a well known binary format.
|
||||
|
||||
A SerializedType:
|
||||
- Always a field
|
||||
- Can always go inside an eligible enclosing SerializedType
|
||||
(such as STArray)
|
||||
- Has a field name
|
||||
|
||||
|
||||
Like JSON, a SerializedObject is a basket which has rules
|
||||
on what it can hold.
|
||||
*/
|
||||
// VFALCO TODO Document this as it looks like a central class.
|
||||
// STObject is derived from it
|
||||
//
|
||||
class SerializedType
|
||||
{
|
||||
public:
|
||||
SerializedType () : fName (&sfGeneric)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
explicit SerializedType (SField::ref n) : fName (&n)
|
||||
{
|
||||
assert (fName);
|
||||
}
|
||||
|
||||
virtual ~SerializedType () = default;
|
||||
|
||||
//
|
||||
// overridables
|
||||
//
|
||||
|
||||
virtual
|
||||
SerializedTypeID
|
||||
getSType () const
|
||||
{
|
||||
return STI_NOTPRESENT;
|
||||
}
|
||||
|
||||
virtual
|
||||
std::string
|
||||
getFullText() const;
|
||||
|
||||
// just the value
|
||||
virtual
|
||||
std::string
|
||||
getText() const
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
virtual
|
||||
Json::Value getJson (int /*options*/) const
|
||||
{
|
||||
return getText();
|
||||
}
|
||||
|
||||
virtual
|
||||
void
|
||||
add (Serializer& s) const
|
||||
{
|
||||
// VFALCO Why not just make this pure virtual?
|
||||
assert (false);
|
||||
}
|
||||
|
||||
virtual
|
||||
bool
|
||||
isEquivalent (SerializedType const& t) const;
|
||||
|
||||
virtual
|
||||
bool
|
||||
isDefault () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
// VFALCO TODO Return std::unique_ptr <SerializedType>
|
||||
virtual
|
||||
SerializedType*
|
||||
duplicate () const
|
||||
{
|
||||
return new SerializedType (*fName);
|
||||
}
|
||||
|
||||
public:
|
||||
//
|
||||
// members
|
||||
//
|
||||
|
||||
static
|
||||
std::unique_ptr <SerializedType>
|
||||
deserialize (SField::ref name)
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (new SerializedType (name));
|
||||
}
|
||||
|
||||
/** A SerializedType is a field.
|
||||
This sets the name.
|
||||
*/
|
||||
void setFName (SField::ref n)
|
||||
{
|
||||
fName = &n;
|
||||
assert (fName);
|
||||
}
|
||||
SField::ref getFName () const
|
||||
{
|
||||
return *fName;
|
||||
}
|
||||
std::unique_ptr<SerializedType> clone () const
|
||||
{
|
||||
return std::unique_ptr<SerializedType> (duplicate ());
|
||||
}
|
||||
|
||||
|
||||
void addFieldID (Serializer& s) const
|
||||
{
|
||||
assert (fName->isBinary ());
|
||||
s.addFieldID (fName->fieldType, fName->fieldValue);
|
||||
}
|
||||
|
||||
SerializedType& operator= (const SerializedType& t);
|
||||
|
||||
bool operator== (const SerializedType& t) const
|
||||
{
|
||||
return (getSType () == t.getSType ()) && isEquivalent (t);
|
||||
}
|
||||
bool operator!= (const SerializedType& t) const
|
||||
{
|
||||
return (getSType () != t.getSType ()) || !isEquivalent (t);
|
||||
}
|
||||
|
||||
template <class D>
|
||||
D& downcast()
|
||||
{
|
||||
D* ptr = dynamic_cast<D*> (this);
|
||||
if (ptr == nullptr)
|
||||
throw std::runtime_error ("type mismatch");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
template <class D>
|
||||
D const& downcast() const
|
||||
{
|
||||
D const * ptr = dynamic_cast<D const*> (this);
|
||||
if (ptr == nullptr)
|
||||
throw std::runtime_error ("type mismatch");
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
// VFALCO TODO make accessors for this
|
||||
SField::ptr fName;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline SerializedType* new_clone (const SerializedType& s)
|
||||
{
|
||||
SerializedType* const copy (s.clone ().release ());
|
||||
assert (typeid (*copy) == typeid (s));
|
||||
return copy;
|
||||
}
|
||||
|
||||
inline void delete_clone (const SerializedType* s)
|
||||
{
|
||||
boost::checked_delete (s);
|
||||
}
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& out, const SerializedType& t)
|
||||
{
|
||||
return out << t.getFullText ();
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -18,13 +18,6 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
|
||||
#include <ripple/types/base_uint.h>
|
||||
#include <ripple/types/Book.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/SerializedObjectTemplate.h>
|
||||
#include <ripple/protocol/SOTemplate.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
68
src/ripple/protocol/impl/STAccount.cpp
Normal file
68
src/ripple/protocol/impl/STAccount.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::string STAccount::getText () const
|
||||
{
|
||||
Account u;
|
||||
RippleAddress a;
|
||||
|
||||
if (!getValueH160 (u))
|
||||
return STBlob::getText ();
|
||||
|
||||
a.setAccountID (u);
|
||||
return a.humanAccountID ();
|
||||
}
|
||||
|
||||
STAccount*
|
||||
STAccount::construct (SerializerIterator& u, SField::ref name)
|
||||
{
|
||||
return new STAccount (name, u.getVL ());
|
||||
}
|
||||
|
||||
STAccount::STAccount (SField::ref n, Account const& v) : STBlob (n)
|
||||
{
|
||||
peekValue ().insert (peekValue ().end (), v.begin (), v.end ());
|
||||
}
|
||||
|
||||
bool STAccount::isValueH160 () const
|
||||
{
|
||||
return peekValue ().size () == (160 / 8);
|
||||
}
|
||||
|
||||
RippleAddress STAccount::getValueNCA () const
|
||||
{
|
||||
RippleAddress a;
|
||||
Account account;
|
||||
|
||||
if (getValueH160 (account))
|
||||
a.setAccountID (account);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void STAccount::setValueNCA (RippleAddress const& nca)
|
||||
{
|
||||
setValueH160 (nca.getAccountID ());
|
||||
}
|
||||
|
||||
} // ripple
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <ripple/crypto/CBigNum.h>
|
||||
#include <ripple/core/SystemParameters.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/types/UintTypes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
@@ -39,7 +39,7 @@ static const std::uint64_t tenTo17 = tenTo14 * 1000;
|
||||
STAmount::STAmount (SField::ref name, Issue const& issue,
|
||||
mantissa_type mantissa, exponent_type exponent,
|
||||
bool native, bool negative)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
, mIssue (issue)
|
||||
, mValue (mantissa)
|
||||
, mOffset (exponent)
|
||||
@@ -52,7 +52,7 @@ STAmount::STAmount (SField::ref name, Issue const& issue,
|
||||
STAmount::STAmount (SField::ref name, Issue const& issue,
|
||||
mantissa_type mantissa, exponent_type exponent,
|
||||
bool native, bool negative, unchecked)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
, mIssue (issue)
|
||||
, mValue (mantissa)
|
||||
, mOffset (exponent)
|
||||
@@ -62,7 +62,7 @@ STAmount::STAmount (SField::ref name, Issue const& issue,
|
||||
}
|
||||
|
||||
STAmount::STAmount (SField::ref name, std::int64_t mantissa)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
, mOffset (0)
|
||||
, mIsNative (true)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ STAmount::STAmount (SField::ref name, std::int64_t mantissa)
|
||||
|
||||
STAmount::STAmount (SField::ref name,
|
||||
std::uint64_t mantissa, bool negative)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
, mValue (mantissa)
|
||||
, mOffset (0)
|
||||
, mIsNative (true)
|
||||
@@ -81,7 +81,7 @@ STAmount::STAmount (SField::ref name,
|
||||
|
||||
STAmount::STAmount (SField::ref name, Issue const& issue,
|
||||
std::uint64_t mantissa, int exponent, bool negative)
|
||||
: SerializedType (name)
|
||||
: STBase (name)
|
||||
, mIssue (issue)
|
||||
, mValue (mantissa)
|
||||
, mOffset (exponent)
|
||||
@@ -593,7 +593,7 @@ void STAmount::roundSelf ()
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// SerializedType
|
||||
// STBase
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -745,7 +745,7 @@ STAmount::add (Serializer& s) const
|
||||
}
|
||||
|
||||
bool
|
||||
STAmount::isEquivalent (const SerializedType& t) const
|
||||
STAmount::isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STAmount* v = dynamic_cast<const STAmount*> (&t);
|
||||
return v && (*v == *this);
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::unique_ptr<SerializedType>
|
||||
std::unique_ptr<STBase>
|
||||
STArray::deserialize (SerializerIterator& sit, SField::ref field)
|
||||
{
|
||||
std::unique_ptr <STArray> ret (std::make_unique <STArray> (field));
|
||||
@@ -130,7 +130,7 @@ void STArray::add (Serializer& s) const
|
||||
}
|
||||
}
|
||||
|
||||
bool STArray::isEquivalent (const SerializedType& t) const
|
||||
bool STArray::isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STArray* v = dynamic_cast<const STArray*> (&t);
|
||||
|
||||
|
||||
181
src/ripple/protocol/impl/STBase.cpp
Normal file
181
src/ripple/protocol/impl/STBase.cpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <cassert>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
STBase::STBase()
|
||||
: fName(&sfGeneric)
|
||||
{
|
||||
}
|
||||
|
||||
STBase::STBase (SField::ref n)
|
||||
: fName(&n)
|
||||
{
|
||||
assert(fName);
|
||||
}
|
||||
|
||||
STBase&
|
||||
STBase::operator= (const STBase& t)
|
||||
{
|
||||
if ((t.fName != fName) && fName->isUseful() && t.fName->isUseful())
|
||||
{
|
||||
// VFALCO We shouldn't be logging at this low a level
|
||||
/*
|
||||
WriteLog ((t.getSType () == STI_AMOUNT) ? lsTRACE : lsWARNING, STBase) // This is common for amounts
|
||||
<< "Caution: " << t.fName->getName () << " not replacing " << fName->getName ();
|
||||
*/
|
||||
}
|
||||
if (!fName->isUseful())
|
||||
fName = t.fName;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
STBase::operator== (const STBase& t) const
|
||||
{
|
||||
return (getSType () == t.getSType ()) && isEquivalent (t);
|
||||
}
|
||||
|
||||
bool
|
||||
STBase::operator!= (const STBase& t) const
|
||||
{
|
||||
return (getSType () != t.getSType ()) || !isEquivalent (t);
|
||||
}
|
||||
|
||||
SerializedTypeID
|
||||
STBase::getSType() const
|
||||
{
|
||||
return STI_NOTPRESENT;
|
||||
}
|
||||
|
||||
std::string
|
||||
STBase::getFullText() const
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
if (getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
if (fName->hasName ())
|
||||
{
|
||||
ret = fName->fieldName;
|
||||
ret += " = ";
|
||||
}
|
||||
|
||||
ret += getText ();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string
|
||||
STBase::getText() const
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
Json::Value
|
||||
STBase::getJson (int /*options*/) const
|
||||
{
|
||||
return getText();
|
||||
}
|
||||
|
||||
void
|
||||
STBase::add (Serializer& s) const
|
||||
{
|
||||
// Should never be called
|
||||
assert(false);
|
||||
}
|
||||
|
||||
bool
|
||||
STBase::isEquivalent (const STBase& t) const
|
||||
{
|
||||
assert (getSType () == STI_NOTPRESENT);
|
||||
if (t.getSType () == STI_NOTPRESENT)
|
||||
return true;
|
||||
// VFALCO We shouldn't be logging at this low a level
|
||||
//WriteLog (lsDEBUG, STBase) << "notEquiv " << getFullText() << " not STI_NOTPRESENT";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
STBase::isDefault() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
STBase::setFName (SField::ref n)
|
||||
{
|
||||
fName = &n;
|
||||
assert (fName);
|
||||
}
|
||||
|
||||
SField::ref
|
||||
STBase::getFName() const
|
||||
{
|
||||
return *fName;
|
||||
}
|
||||
|
||||
std::unique_ptr<STBase>
|
||||
STBase::clone() const
|
||||
{
|
||||
return std::unique_ptr<STBase> (duplicate());
|
||||
}
|
||||
|
||||
void
|
||||
STBase::addFieldID (Serializer& s) const
|
||||
{
|
||||
assert (fName->isBinary ());
|
||||
s.addFieldID (fName->fieldType, fName->fieldValue);
|
||||
}
|
||||
|
||||
std::unique_ptr <STBase>
|
||||
STBase::deserialize (SField::ref name)
|
||||
{
|
||||
return std::make_unique<STBase>(name);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
STBase*
|
||||
new_clone (const STBase& s)
|
||||
{
|
||||
STBase* const copy (s.clone ().release ());
|
||||
assert (typeid (*copy) == typeid (s));
|
||||
return copy;
|
||||
}
|
||||
|
||||
void
|
||||
delete_clone (const STBase* s)
|
||||
{
|
||||
boost::checked_delete (s);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<< (std::ostream& out, const STBase& t)
|
||||
{
|
||||
return out << t.getFullText ();
|
||||
}
|
||||
|
||||
} // ripple
|
||||
47
src/ripple/protocol/impl/STBlob.cpp
Normal file
47
src/ripple/protocol/impl/STBlob.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/STBlob.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
STBlob::STBlob (SerializerIterator& st, SField::ref name)
|
||||
: STBase (name)
|
||||
{
|
||||
value = st.getVL ();
|
||||
}
|
||||
|
||||
std::string STBlob::getText () const
|
||||
{
|
||||
return strHex (value);
|
||||
}
|
||||
|
||||
STBlob* STBlob::construct (SerializerIterator& u, SField::ref name)
|
||||
{
|
||||
return new STBlob (name, u.getVL ());
|
||||
}
|
||||
|
||||
bool STBlob::isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STBlob* v = dynamic_cast<const STBlob*> (&t);
|
||||
return v && (value == v->value);
|
||||
}
|
||||
|
||||
} // ripple
|
||||
@@ -63,7 +63,7 @@ Json::Value STUInt8::getJson (int) const
|
||||
if (transResultInfo (static_cast<TER> (value_), token, human))
|
||||
return token;
|
||||
else
|
||||
WriteLog (lsWARNING, SerializedType)
|
||||
WriteLog (lsWARNING, STBase)
|
||||
<< "Unknown result code in metadata: " << value_;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry (
|
||||
STLedgerEntry::STLedgerEntry (
|
||||
SerializerIterator& sit, uint256 const& index)
|
||||
: STObject (sfLedgerEntry), mIndex (index), mMutable (true)
|
||||
{
|
||||
@@ -27,7 +30,7 @@ SerializedLedgerEntry::SerializedLedgerEntry (
|
||||
setSLEType ();
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry (
|
||||
STLedgerEntry::STLedgerEntry (
|
||||
const Serializer& s, uint256 const& index)
|
||||
: STObject (sfLedgerEntry), mIndex (index), mMutable (true)
|
||||
{
|
||||
@@ -37,14 +40,14 @@ SerializedLedgerEntry::SerializedLedgerEntry (
|
||||
setSLEType ();
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry (
|
||||
STLedgerEntry::STLedgerEntry (
|
||||
const STObject & object, uint256 const& index)
|
||||
: STObject (object), mIndex(index), mMutable (true)
|
||||
{
|
||||
setSLEType ();
|
||||
}
|
||||
|
||||
void SerializedLedgerEntry::setSLEType ()
|
||||
void STLedgerEntry::setSLEType ()
|
||||
{
|
||||
mFormat = LedgerFormats::getInstance().findByType (
|
||||
static_cast <LedgerEntryType> (getFieldU16 (sfLedgerEntryType)));
|
||||
@@ -62,7 +65,7 @@ void SerializedLedgerEntry::setSLEType ()
|
||||
}
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::SerializedLedgerEntry (LedgerEntryType type, uint256 const& index) :
|
||||
STLedgerEntry::STLedgerEntry (LedgerEntryType type, uint256 const& index) :
|
||||
STObject (sfLedgerEntry), mIndex (index), mType (type), mMutable (true)
|
||||
{
|
||||
mFormat = LedgerFormats::getInstance().findByType (type);
|
||||
@@ -75,14 +78,14 @@ SerializedLedgerEntry::SerializedLedgerEntry (LedgerEntryType type, uint256 cons
|
||||
static_cast <std::uint16_t> (mFormat->getType ()));
|
||||
}
|
||||
|
||||
SerializedLedgerEntry::pointer SerializedLedgerEntry::getMutable () const
|
||||
STLedgerEntry::pointer STLedgerEntry::getMutable () const
|
||||
{
|
||||
SerializedLedgerEntry::pointer ret = std::make_shared<SerializedLedgerEntry> (std::cref (*this));
|
||||
STLedgerEntry::pointer ret = std::make_shared<STLedgerEntry> (std::cref (*this));
|
||||
ret->mMutable = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string SerializedLedgerEntry::getFullText () const
|
||||
std::string STLedgerEntry::getFullText () const
|
||||
{
|
||||
std::string ret = "\"";
|
||||
ret += to_string (mIndex);
|
||||
@@ -94,14 +97,14 @@ std::string SerializedLedgerEntry::getFullText () const
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string SerializedLedgerEntry::getText () const
|
||||
std::string STLedgerEntry::getText () const
|
||||
{
|
||||
return str (boost::format ("{ %s, %s }")
|
||||
% to_string (mIndex)
|
||||
% STObject::getText ());
|
||||
}
|
||||
|
||||
Json::Value SerializedLedgerEntry::getJson (int options) const
|
||||
Json::Value STLedgerEntry::getJson (int options) const
|
||||
{
|
||||
Json::Value ret (STObject::getJson (options));
|
||||
|
||||
@@ -110,27 +113,27 @@ Json::Value SerializedLedgerEntry::getJson (int options) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::isThreadedType ()
|
||||
bool STLedgerEntry::isThreadedType ()
|
||||
{
|
||||
return getFieldIndex (sfPreviousTxnID) != -1;
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::isThreaded ()
|
||||
bool STLedgerEntry::isThreaded ()
|
||||
{
|
||||
return isFieldPresent (sfPreviousTxnID);
|
||||
}
|
||||
|
||||
uint256 SerializedLedgerEntry::getThreadedTransaction ()
|
||||
uint256 STLedgerEntry::getThreadedTransaction ()
|
||||
{
|
||||
return getFieldH256 (sfPreviousTxnID);
|
||||
}
|
||||
|
||||
std::uint32_t SerializedLedgerEntry::getThreadedLedger ()
|
||||
std::uint32_t STLedgerEntry::getThreadedLedger ()
|
||||
{
|
||||
return getFieldU32 (sfPreviousTxnLgrSeq);
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq,
|
||||
bool STLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq,
|
||||
uint256& prevTxID, std::uint32_t& prevLedgerID)
|
||||
{
|
||||
uint256 oldPrevTxID = getFieldH256 (sfPreviousTxnID);
|
||||
@@ -150,32 +153,32 @@ bool SerializedLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::hasOneOwner ()
|
||||
bool STLedgerEntry::hasOneOwner ()
|
||||
{
|
||||
return (mType != ltACCOUNT_ROOT) && (getFieldIndex (sfAccount) != -1);
|
||||
}
|
||||
|
||||
bool SerializedLedgerEntry::hasTwoOwners ()
|
||||
bool STLedgerEntry::hasTwoOwners ()
|
||||
{
|
||||
return mType == ltRIPPLE_STATE;
|
||||
}
|
||||
|
||||
RippleAddress SerializedLedgerEntry::getOwner ()
|
||||
RippleAddress STLedgerEntry::getOwner ()
|
||||
{
|
||||
return getFieldAccount (sfAccount);
|
||||
}
|
||||
|
||||
RippleAddress SerializedLedgerEntry::getFirstOwner ()
|
||||
RippleAddress STLedgerEntry::getFirstOwner ()
|
||||
{
|
||||
return RippleAddress::createAccountID (getFieldAmount (sfLowLimit).getIssuer ());
|
||||
}
|
||||
|
||||
RippleAddress SerializedLedgerEntry::getSecondOwner ()
|
||||
RippleAddress STLedgerEntry::getSecondOwner ()
|
||||
{
|
||||
return RippleAddress::createAccountID (getFieldAmount (sfHighLimit).getIssuer ());
|
||||
}
|
||||
|
||||
std::vector<uint256> SerializedLedgerEntry::getOwners ()
|
||||
std::vector<uint256> STLedgerEntry::getOwners ()
|
||||
{
|
||||
std::vector<uint256> owners;
|
||||
Account account;
|
||||
@@ -20,7 +20,8 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/protocol/SerializedType.h>
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
#include <ripple/protocol/STObject.h>
|
||||
#include <ripple/protocol/STParsedJSON.h>
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::unique_ptr<SerializedType>
|
||||
std::unique_ptr<STBase>
|
||||
STObject::makeDefaultObject (SerializedTypeID id, SField::ref name)
|
||||
{
|
||||
assert ((id == STI_NOTPRESENT) || (id == name.fieldType));
|
||||
@@ -38,7 +39,7 @@ STObject::makeDefaultObject (SerializedTypeID id, SField::ref name)
|
||||
switch (id)
|
||||
{
|
||||
case STI_NOTPRESENT:
|
||||
return std::make_unique <SerializedType> (name);
|
||||
return std::make_unique <STBase> (name);
|
||||
|
||||
case STI_UINT8:
|
||||
return std::make_unique <STUInt8> (name);
|
||||
@@ -68,7 +69,7 @@ STObject::makeDefaultObject (SerializedTypeID id, SField::ref name)
|
||||
return std::make_unique <STVector256> (name);
|
||||
|
||||
case STI_VL:
|
||||
return std::make_unique <STVariableLength> (name);
|
||||
return std::make_unique <STBlob> (name);
|
||||
|
||||
case STI_ACCOUNT:
|
||||
return std::make_unique <STAccount> (name);
|
||||
@@ -91,14 +92,14 @@ STObject::makeDefaultObject (SerializedTypeID id, SField::ref name)
|
||||
}
|
||||
|
||||
// VFALCO TODO Remove the 'depth' parameter
|
||||
std::unique_ptr<SerializedType>
|
||||
std::unique_ptr<STBase>
|
||||
STObject::makeDeserializedObject (SerializedTypeID id, SField::ref name,
|
||||
SerializerIterator& sit, int depth)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case STI_NOTPRESENT:
|
||||
return SerializedType::deserialize (name);
|
||||
return STBase::deserialize (name);
|
||||
|
||||
case STI_UINT8:
|
||||
return STUInt8::deserialize (sit, name);
|
||||
@@ -128,7 +129,7 @@ STObject::makeDeserializedObject (SerializedTypeID id, SField::ref name,
|
||||
return STVector256::deserialize (sit, name);
|
||||
|
||||
case STI_VL:
|
||||
return STVariableLength::deserialize (sit, name);
|
||||
return STBlob::deserialize (sit, name);
|
||||
|
||||
case STI_ACCOUNT:
|
||||
return STAccount::deserialize (sit, name);
|
||||
@@ -163,12 +164,12 @@ void STObject::set (const SOTemplate& type)
|
||||
|
||||
bool STObject::setType (const SOTemplate& type)
|
||||
{
|
||||
boost::ptr_vector<SerializedType> newData (type.peek ().size ());
|
||||
boost::ptr_vector<STBase> newData (type.peek ().size ());
|
||||
bool valid = true;
|
||||
|
||||
mType = &type;
|
||||
|
||||
SerializedType** array = mData.c_array();
|
||||
STBase** array = mData.c_array();
|
||||
std::size_t count = mData.size ();
|
||||
|
||||
for (auto const& elem : type.peek ())
|
||||
@@ -233,7 +234,7 @@ bool STObject::setType (const SOTemplate& type)
|
||||
|
||||
bool STObject::isValidForType ()
|
||||
{
|
||||
boost::ptr_vector<SerializedType>::iterator it = mData.begin ();
|
||||
boost::ptr_vector<STBase>::iterator it = mData.begin ();
|
||||
|
||||
for (SOTemplate::value_type const& elem : mType->peek ())
|
||||
{
|
||||
@@ -311,7 +312,7 @@ bool STObject::set (SerializerIterator& sit, int depth)
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<SerializedType>
|
||||
std::unique_ptr<STBase>
|
||||
STObject::deserialize (SerializerIterator& sit, SField::ref name)
|
||||
{
|
||||
std::unique_ptr <STObject> object (std::make_unique <STObject> (name));
|
||||
@@ -319,9 +320,9 @@ STObject::deserialize (SerializerIterator& sit, SField::ref name)
|
||||
return std::move (object);
|
||||
}
|
||||
|
||||
bool STObject::hasMatchingEntry (const SerializedType& t)
|
||||
bool STObject::hasMatchingEntry (const STBase& t)
|
||||
{
|
||||
const SerializedType* o = peekAtPField (t.getFName ());
|
||||
const STBase* o = peekAtPField (t.getFName ());
|
||||
|
||||
if (!o)
|
||||
return false;
|
||||
@@ -341,7 +342,7 @@ std::string STObject::getFullText () const
|
||||
}
|
||||
else ret = "{";
|
||||
|
||||
for (SerializedType const& elem : mData)
|
||||
for (STBase const& elem : mData)
|
||||
{
|
||||
if (elem.getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
@@ -360,9 +361,9 @@ std::string STObject::getFullText () const
|
||||
|
||||
void STObject::add (Serializer& s, bool withSigningFields) const
|
||||
{
|
||||
std::map<int, const SerializedType*> fields;
|
||||
std::map<int, const STBase*> fields;
|
||||
|
||||
for (SerializedType const& elem : mData)
|
||||
for (STBase const& elem : mData)
|
||||
{
|
||||
// pick out the fields and sort them
|
||||
if ((elem.getSType () != STI_NOTPRESENT) &&
|
||||
@@ -372,11 +373,11 @@ void STObject::add (Serializer& s, bool withSigningFields) const
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::map<int, const SerializedType*>::value_type field_iterator;
|
||||
typedef std::map<int, const STBase*>::value_type field_iterator;
|
||||
for (auto const& mapEntry : fields)
|
||||
{
|
||||
// insert them in sorted order
|
||||
const SerializedType* field = mapEntry.second;
|
||||
const STBase* field = mapEntry.second;
|
||||
|
||||
// When we serialize an object inside another object,
|
||||
// the type associated by rule with this field name
|
||||
@@ -398,7 +399,7 @@ std::string STObject::getText () const
|
||||
{
|
||||
std::string ret = "{";
|
||||
bool first = false;
|
||||
for (SerializedType const& elem : mData)
|
||||
for (STBase const& elem : mData)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
@@ -412,7 +413,7 @@ std::string STObject::getText () const
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool STObject::isEquivalent (const SerializedType& t) const
|
||||
bool STObject::isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STObject* v = dynamic_cast<const STObject*> (&t);
|
||||
|
||||
@@ -423,7 +424,7 @@ bool STObject::isEquivalent (const SerializedType& t) const
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef boost::ptr_vector<SerializedType>::const_iterator const_iter;
|
||||
typedef boost::ptr_vector<STBase>::const_iterator const_iter;
|
||||
const_iter it1 = mData.begin (), end1 = mData.end ();
|
||||
const_iter it2 = v->mData.begin (), end2 = v->mData.end ();
|
||||
|
||||
@@ -473,7 +474,7 @@ int STObject::getFieldIndex (SField::ref field) const
|
||||
return mType->getIndex (field);
|
||||
|
||||
int i = 0;
|
||||
for (SerializedType const& elem : mData)
|
||||
for (STBase const& elem : mData)
|
||||
{
|
||||
if (elem.getFName () == field)
|
||||
return i;
|
||||
@@ -483,7 +484,7 @@ int STObject::getFieldIndex (SField::ref field) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
const SerializedType& STObject::peekAtField (SField::ref field) const
|
||||
const STBase& STObject::peekAtField (SField::ref field) const
|
||||
{
|
||||
int index = getFieldIndex (field);
|
||||
|
||||
@@ -493,7 +494,7 @@ const SerializedType& STObject::peekAtField (SField::ref field) const
|
||||
return peekAtIndex (index);
|
||||
}
|
||||
|
||||
SerializedType& STObject::getField (SField::ref field)
|
||||
STBase& STObject::getField (SField::ref field)
|
||||
{
|
||||
int index = getFieldIndex (field);
|
||||
|
||||
@@ -508,7 +509,7 @@ SField::ref STObject::getFieldSType (int index) const
|
||||
return mData[index].getFName ();
|
||||
}
|
||||
|
||||
const SerializedType* STObject::peekAtPField (SField::ref field) const
|
||||
const STBase* STObject::peekAtPField (SField::ref field) const
|
||||
{
|
||||
int index = getFieldIndex (field);
|
||||
|
||||
@@ -518,7 +519,7 @@ const SerializedType* STObject::peekAtPField (SField::ref field) const
|
||||
return peekAtPIndex (index);
|
||||
}
|
||||
|
||||
SerializedType* STObject::getPField (SField::ref field, bool createOkay)
|
||||
STBase* STObject::getPField (SField::ref field, bool createOkay)
|
||||
{
|
||||
int index = getFieldIndex (field);
|
||||
|
||||
@@ -545,7 +546,7 @@ bool STObject::isFieldPresent (SField::ref field) const
|
||||
|
||||
STObject& STObject::peekFieldObject (SField::ref field)
|
||||
{
|
||||
SerializedType* rf = getPField (field, true);
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -598,7 +599,7 @@ std::uint32_t STObject::getFlags (void) const
|
||||
return t->getValue ();
|
||||
}
|
||||
|
||||
SerializedType* STObject::makeFieldPresent (SField::ref field)
|
||||
STBase* STObject::makeFieldPresent (SField::ref field)
|
||||
{
|
||||
int index = getFieldIndex (field);
|
||||
|
||||
@@ -610,7 +611,7 @@ SerializedType* STObject::makeFieldPresent (SField::ref field)
|
||||
return getPIndex (giveObject (makeNonPresentObject (field)));
|
||||
}
|
||||
|
||||
SerializedType* f = getPIndex (index);
|
||||
STBase* f = getPIndex (index);
|
||||
|
||||
if (f->getSType () != STI_NOTPRESENT)
|
||||
return f;
|
||||
@@ -626,7 +627,7 @@ void STObject::makeFieldAbsent (SField::ref field)
|
||||
if (index == -1)
|
||||
throw std::runtime_error ("Field not found");
|
||||
|
||||
const SerializedType& f = peekAtIndex (index);
|
||||
const STBase& f = peekAtIndex (index);
|
||||
|
||||
if (f.getSType () == STI_NOTPRESENT)
|
||||
return;
|
||||
@@ -652,7 +653,7 @@ void STObject::delField (int index)
|
||||
|
||||
std::string STObject::getFieldString (SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField (field);
|
||||
const STBase* rf = peekAtPField (field);
|
||||
|
||||
if (!rf) throw std::runtime_error ("Field not found");
|
||||
|
||||
@@ -696,7 +697,7 @@ uint256 STObject::getFieldH256 (SField::ref field) const
|
||||
|
||||
RippleAddress STObject::getFieldAccount (SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField (field);
|
||||
const STBase* rf = peekAtPField (field);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -735,7 +736,7 @@ Account STObject::getFieldAccount160 (SField::ref field) const
|
||||
|
||||
Blob STObject::getFieldVL (SField::ref field) const
|
||||
{
|
||||
return getFieldByValue <STVariableLength> (field);
|
||||
return getFieldByValue <STBlob> (field);
|
||||
}
|
||||
|
||||
STAmount const& STObject::getFieldAmount (SField::ref field) const
|
||||
@@ -799,7 +800,7 @@ void STObject::setFieldV256 (SField::ref field, STVector256 const& v)
|
||||
|
||||
void STObject::setFieldAccount (SField::ref field, Account const& v)
|
||||
{
|
||||
SerializedType* rf = getPField (field, true);
|
||||
STBase* rf = getPField (field, true);
|
||||
|
||||
if (!rf)
|
||||
throw std::runtime_error ("Field not found");
|
||||
@@ -817,7 +818,7 @@ void STObject::setFieldAccount (SField::ref field, Account const& v)
|
||||
|
||||
void STObject::setFieldVL (SField::ref field, Blob const& v)
|
||||
{
|
||||
setFieldUsingSetValue <STVariableLength> (field, v);
|
||||
setFieldUsingSetValue <STBlob> (field, v);
|
||||
}
|
||||
|
||||
void STObject::setFieldAmount (SField::ref field, STAmount const& v)
|
||||
@@ -859,13 +860,13 @@ bool STObject::operator== (const STObject& obj) const
|
||||
// This is not particularly efficient, and only compares data elements
|
||||
// with binary representations
|
||||
int matches = 0;
|
||||
for (SerializedType const& t1 : mData)
|
||||
for (STBase const& t1 : mData)
|
||||
{
|
||||
if ((t1.getSType () != STI_NOTPRESENT) && t1.getFName ().isBinary ())
|
||||
{
|
||||
// each present field must have a matching field
|
||||
bool match = false;
|
||||
for (SerializedType const& t2 : obj.mData)
|
||||
for (STBase const& t2 : obj.mData)
|
||||
{
|
||||
if (t1.getFName () == t2.getFName ())
|
||||
{
|
||||
@@ -889,7 +890,7 @@ bool STObject::operator== (const STObject& obj) const
|
||||
}
|
||||
|
||||
int fields = 0;
|
||||
for (SerializedType const& t2 : obj.mData)
|
||||
for (STBase const& t2 : obj.mData)
|
||||
{
|
||||
if ((t2.getSType () != STI_NOTPRESENT) && t2.getFName ().isBinary ())
|
||||
++fields;
|
||||
|
||||
@@ -128,14 +128,14 @@ static Json::Value singleton_expected (std::string const& object,
|
||||
|
||||
// This function is used by parseObject to parse any JSON type that doesn't
|
||||
// recurse. Everything represented here is a leaf-type.
|
||||
static std::unique_ptr <SerializedType> parseLeaf (
|
||||
static std::unique_ptr <STBase> parseLeaf (
|
||||
std::string const& json_name,
|
||||
std::string const& fieldName,
|
||||
SField::ptr name,
|
||||
Json::Value const& value,
|
||||
Json::Value& error)
|
||||
{
|
||||
std::unique_ptr <SerializedType> ret;
|
||||
std::unique_ptr <STBase> ret;
|
||||
|
||||
SField::ref field = SField::getField (fieldName);
|
||||
|
||||
@@ -406,7 +406,7 @@ static std::unique_ptr <SerializedType> parseLeaf (
|
||||
if (!vBlob.second)
|
||||
throw std::invalid_argument ("invalid data");
|
||||
|
||||
ret = std::make_unique <STVariableLength> (field, vBlob.first);
|
||||
ret = std::make_unique <STBlob> (field, vBlob.first);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -680,7 +680,7 @@ static bool parseObject (
|
||||
|
||||
SField::ptr name (&inName);
|
||||
|
||||
boost::ptr_vector<SerializedType> data;
|
||||
boost::ptr_vector<STBase> data;
|
||||
Json::Value::Members members (json.getMemberNames ());
|
||||
|
||||
for (Json::Value::Members::iterator it (members.begin ());
|
||||
@@ -750,7 +750,7 @@ static bool parseObject (
|
||||
// Everything else (types that don't recurse).
|
||||
default:
|
||||
{
|
||||
std::unique_ptr <SerializedType> serTyp =
|
||||
std::unique_ptr <STBase> serTyp =
|
||||
parseLeaf (json_name, fieldName, name, value, error);
|
||||
|
||||
if (!serTyp)
|
||||
|
||||
@@ -17,181 +17,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <ripple/protocol/SerializedTypes.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/STPathSet.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
const STAmount saZero (noIssue(), 0u);
|
||||
const STAmount saOne (noIssue(), 1u);
|
||||
|
||||
SerializedType& SerializedType::operator= (const SerializedType& t)
|
||||
{
|
||||
if ((t.fName != fName) && fName->isUseful () && t.fName->isUseful ())
|
||||
{
|
||||
WriteLog ((t.getSType () == STI_AMOUNT) ? lsTRACE : lsWARNING, SerializedType) // This is common for amounts
|
||||
<< "Caution: " << t.fName->getName () << " not replacing " << fName->getName ();
|
||||
}
|
||||
|
||||
if (!fName->isUseful ()) fName = t.fName;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool SerializedType::isEquivalent (const SerializedType& t) const
|
||||
{
|
||||
assert (getSType () == STI_NOTPRESENT);
|
||||
if (t.getSType () == STI_NOTPRESENT)
|
||||
return true;
|
||||
WriteLog (lsDEBUG, SerializedType) << "notEquiv " << getFullText() << " not STI_NOTPRESENT";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string SerializedType::getFullText () const
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
if (getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
if (fName->hasName ())
|
||||
{
|
||||
ret = fName->fieldName;
|
||||
ret += " = ";
|
||||
}
|
||||
|
||||
ret += getText ();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
// STVariableLength
|
||||
//
|
||||
|
||||
STVariableLength::STVariableLength (SerializerIterator& st, SField::ref name) : SerializedType (name)
|
||||
{
|
||||
value = st.getVL ();
|
||||
}
|
||||
|
||||
std::string STVariableLength::getText () const
|
||||
{
|
||||
return strHex (value);
|
||||
}
|
||||
|
||||
STVariableLength* STVariableLength::construct (SerializerIterator& u, SField::ref name)
|
||||
{
|
||||
return new STVariableLength (name, u.getVL ());
|
||||
}
|
||||
|
||||
bool STVariableLength::isEquivalent (const SerializedType& t) const
|
||||
{
|
||||
const STVariableLength* v = dynamic_cast<const STVariableLength*> (&t);
|
||||
return v && (value == v->value);
|
||||
}
|
||||
|
||||
std::string STAccount::getText () const
|
||||
{
|
||||
Account u;
|
||||
RippleAddress a;
|
||||
|
||||
if (!getValueH160 (u))
|
||||
return STVariableLength::getText ();
|
||||
|
||||
a.setAccountID (u);
|
||||
return a.humanAccountID ();
|
||||
}
|
||||
|
||||
STAccount* STAccount::construct (SerializerIterator& u, SField::ref name)
|
||||
{
|
||||
return new STAccount (name, u.getVL ());
|
||||
}
|
||||
|
||||
//
|
||||
// STVector256
|
||||
//
|
||||
|
||||
// Return a new object from a SerializerIterator.
|
||||
STVector256* STVector256::construct (SerializerIterator& u, SField::ref name)
|
||||
{
|
||||
Blob data = u.getVL ();
|
||||
Blob ::iterator begin = data.begin ();
|
||||
|
||||
std::unique_ptr<STVector256> vec (new STVector256 (name));
|
||||
|
||||
int count = data.size () / (256 / 8);
|
||||
vec->mValue.reserve (count);
|
||||
|
||||
unsigned int uStart = 0;
|
||||
|
||||
for (unsigned int i = 0; i != count; i++)
|
||||
{
|
||||
unsigned int uEnd = uStart + (256 / 8);
|
||||
|
||||
// This next line could be optimized to construct a default uint256 in the vector and then copy into it
|
||||
vec->mValue.push_back (uint256 (Blob (begin + uStart, begin + uEnd)));
|
||||
uStart = uEnd;
|
||||
}
|
||||
|
||||
return vec.release ();
|
||||
}
|
||||
|
||||
void STVector256::add (Serializer& s) const
|
||||
{
|
||||
assert (fName->isBinary ());
|
||||
assert (fName->fieldType == STI_VECTOR256);
|
||||
s.addVL (mValue.empty () ? nullptr : mValue[0].begin (), mValue.size () * (256 / 8));
|
||||
}
|
||||
|
||||
bool STVector256::isEquivalent (const SerializedType& t) const
|
||||
{
|
||||
const STVector256* v = dynamic_cast<const STVector256*> (&t);
|
||||
return v && (mValue == v->mValue);
|
||||
}
|
||||
|
||||
Json::Value STVector256::getJson (int) const
|
||||
{
|
||||
Json::Value ret (Json::arrayValue);
|
||||
|
||||
for (auto const& vEntry : mValue)
|
||||
ret.append (to_string (vEntry));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
// STAccount
|
||||
//
|
||||
|
||||
STAccount::STAccount (SField::ref n, Account const& v) : STVariableLength (n)
|
||||
{
|
||||
peekValue ().insert (peekValue ().end (), v.begin (), v.end ());
|
||||
}
|
||||
|
||||
bool STAccount::isValueH160 () const
|
||||
{
|
||||
return peekValue ().size () == (160 / 8);
|
||||
}
|
||||
|
||||
RippleAddress STAccount::getValueNCA () const
|
||||
{
|
||||
RippleAddress a;
|
||||
Account account;
|
||||
|
||||
if (getValueH160 (account))
|
||||
a.setAccountID (account);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
void STAccount::setValueNCA (RippleAddress const& nca)
|
||||
{
|
||||
setValueH160 (nca.getAccountID ());
|
||||
}
|
||||
|
||||
std::size_t
|
||||
STPathElement::get_hash (STPathElement const& element)
|
||||
{
|
||||
@@ -229,7 +58,7 @@ STPathSet* STPathSet::construct (SerializerIterator& s, SField::ref name)
|
||||
{
|
||||
if (path.empty ())
|
||||
{
|
||||
WriteLog (lsINFO, SerializedType) << "STPathSet: Empty path.";
|
||||
WriteLog (lsINFO, STBase) << "STPathSet: Empty path.";
|
||||
|
||||
throw std::runtime_error ("empty path");
|
||||
}
|
||||
@@ -244,7 +73,7 @@ STPathSet* STPathSet::construct (SerializerIterator& s, SField::ref name)
|
||||
}
|
||||
else if (iType & ~STPathElement::typeAll)
|
||||
{
|
||||
WriteLog (lsINFO, SerializedType)
|
||||
WriteLog (lsINFO, STBase)
|
||||
<< "STPathSet: Bad path element: " << iType;
|
||||
|
||||
throw std::runtime_error ("bad path element");
|
||||
@@ -274,7 +103,7 @@ STPathSet* STPathSet::construct (SerializerIterator& s, SField::ref name)
|
||||
while (1);
|
||||
}
|
||||
|
||||
bool STPathSet::isEquivalent (const SerializedType& t) const
|
||||
bool STPathSet::isEquivalent (const STBase& t) const
|
||||
{
|
||||
const STPathSet* v = dynamic_cast<const STPathSet*> (&t);
|
||||
return v && (value == v->value);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user