Transactor refactor:

* Allocate transactors on the stack instead of the heap.
* Remove header files and reduce transactor public interface.
This commit is contained in:
Nik Bougalis
2014-09-04 15:12:23 -07:00
parent 624a803955
commit 889c0a0d0f
25 changed files with 2079 additions and 2462 deletions

View File

@@ -126,8 +126,6 @@
</ClCompile>
<ClInclude Include="..\..\build\proto\ripple.pb.h">
</ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\asio\abstract_socket.cpp">
@@ -304,14 +302,14 @@
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -826,14 +824,6 @@
</ClCompile>
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -846,6 +836,14 @@
</ClCompile>
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -1188,6 +1186,8 @@
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\Version.h">
</ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
</ClInclude>
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -2386,53 +2386,33 @@
<ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\AddWallet.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CancelOffer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CancelOffer.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Change.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Change.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOffer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOffer.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Payment.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Payment.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetAccount.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetAccount.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetRegularKey.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetRegularKey.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetTrust.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetTrust.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Transactor.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -3943,57 +3923,6 @@
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\backupable\backupable_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\document_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\json_document.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\put.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\uint64add.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\redis\redis_lists.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_lists.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_exception.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_iterator.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\spatialdb\spatial_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\spatialdb\utils.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\util\arena.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -4167,6 +4096,57 @@
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\util\xxhash.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\backupable\backupable_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\document_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\json_document.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\put.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\uint64add.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\redis\redis_lists.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_lists.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_exception.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_iterator.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\spatialdb\spatial_db.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\spatialdb\utils.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.h">
</ClInclude>
<ClInclude Include="..\..\src\snappy\config\snappy-stubs-public.h">
</ClInclude>
<ClInclude Include="..\..\src\snappy\snappy\snappy-internal.h">

View File

@@ -666,9 +666,6 @@
<ClInclude Include="..\..\build\proto\ripple.pb.h">
<Filter>build\proto</Filter>
</ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
<Filter>.</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
<Filter>beast</Filter>
</ClInclude>
@@ -900,15 +897,15 @@
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
<Filter>beast\crypto\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<Filter>beast\crypto\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
<Filter>beast\crypto\impl\sha2</Filter>
</ClCompile>
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
<Filter>beast\crypto\impl\sha2</Filter>
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<Filter>beast\crypto\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
<Filter>beast\crypto\impl</Filter>
</ClCompile>
@@ -1554,18 +1551,6 @@
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
<Filter>beast\module\core\text</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
<Filter>beast\module\core\thread</Filter>
</ClCompile>
@@ -1581,6 +1566,18 @@
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
<Filter>beast\module\core\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
<Filter>beast\module\core\threads</Filter>
</ClInclude>
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
<Filter>beast\module\core\time</Filter>
</ClCompile>
@@ -2019,6 +2016,9 @@
<ClInclude Include="..\..\src\beast\beast\Version.h">
<Filter>beast</Filter>
</ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
<Filter>.</Filter>
</ClInclude>
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
<Filter>hyperleveldb\db</Filter>
</ClCompile>
@@ -3489,63 +3489,33 @@
<ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\AddWallet.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CancelOffer.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CancelOffer.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Change.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Change.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOffer.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOffer.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Payment.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Payment.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetAccount.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetAccount.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetRegularKey.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetRegularKey.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetTrust.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetTrust.h">
<Filter>ripple\module\app\transactors</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Transactor.cpp">
<Filter>ripple\module\app\transactors</Filter>
</ClCompile>
@@ -5412,66 +5382,6 @@
<ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h">
<Filter>rocksdb2\third-party\rapidjson</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\backupable\backupable_db.cc">
<Filter>rocksdb2\utilities\backupable</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\document_db.cc">
<Filter>rocksdb2\utilities\document</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\json_document.cc">
<Filter>rocksdb2\utilities\document</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.cc">
<Filter>rocksdb2\utilities\geodb</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.h">
<Filter>rocksdb2\utilities\geodb</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators.h">
<Filter>rocksdb2\utilities</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\put.cc">
<Filter>rocksdb2\utilities\merge_operators</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.cc">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.h">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.cc">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.h">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\uint64add.cc">
<Filter>rocksdb2\utilities\merge_operators</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\redis\redis_lists.cc">
<Filter>rocksdb2\utilities\redis</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_lists.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_exception.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_iterator.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\spatialdb\spatial_db.cc">
<Filter>rocksdb2\utilities\spatialdb</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\spatialdb\utils.h">
<Filter>rocksdb2\utilities\spatialdb</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.cc">
<Filter>rocksdb2\utilities\ttl</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.h">
<Filter>rocksdb2\utilities\ttl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\util\arena.cc">
<Filter>rocksdb2\util</Filter>
</ClCompile>
@@ -5676,6 +5586,66 @@
<ClInclude Include="..\..\src\rocksdb2\util\xxhash.h">
<Filter>rocksdb2\util</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\backupable\backupable_db.cc">
<Filter>rocksdb2\utilities\backupable</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\document_db.cc">
<Filter>rocksdb2\utilities\document</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\document\json_document.cc">
<Filter>rocksdb2\utilities\document</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.cc">
<Filter>rocksdb2\utilities\geodb</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\geodb\geodb_impl.h">
<Filter>rocksdb2\utilities\geodb</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators.h">
<Filter>rocksdb2\utilities</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\put.cc">
<Filter>rocksdb2\utilities\merge_operators</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.cc">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend.h">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.cc">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\merge_operators\string_append\stringappend2.h">
<Filter>rocksdb2\utilities\merge_operators\string_append</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\merge_operators\uint64add.cc">
<Filter>rocksdb2\utilities\merge_operators</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rocksdb2\utilities\redis\redis_lists.cc">
<Filter>rocksdb2\utilities\redis</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_lists.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_exception.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb2\utilities\redis\redis_list_iterator.h">
<Filter>rocksdb2\utilities\redis</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\spatialdb\spatial_db.cc">
<Filter>rocksdb2\utilities\spatialdb</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\spatialdb\utils.h">
<Filter>rocksdb2\utilities\spatialdb</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.cc">
<Filter>rocksdb2\utilities\ttl</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb2\utilities\ttl\db_ttl_impl.h">
<Filter>rocksdb2\utilities\ttl</Filter>
</ClInclude>
<ClInclude Include="..\..\src\snappy\config\snappy-stubs-public.h">
<Filter>snappy\config</Filter>
</ClInclude>

View File

@@ -19,7 +19,23 @@
namespace ripple {
TER AddWallet::doApply ()
class AddWallet
: public Transactor
{
public:
AddWallet (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("AddWallet"))
{
}
TER doApply () override
{
std::uint32_t const uTxFlags = mTxn.getFlags ();
@@ -98,5 +114,15 @@ TER AddWallet::doApply ()
return tesSUCCESS;
}
};
TER
transact_AddWallet (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return AddWallet (txn, params, engine).apply ();
}
}

View File

@@ -1,56 +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_TX_WALLETADD_H_INCLUDED
#define RIPPLE_TX_WALLETADD_H_INCLUDED
namespace ripple {
class AddWallet
: public Transactor
{
public:
AddWallet (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("AddWallet"))
{
}
TER doApply ();
};
inline
std::unique_ptr <Transactor>
make_AddWallet (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <AddWallet> (txn, params, engine);
}
}
#endif

View File

@@ -19,8 +19,24 @@
namespace ripple {
class CancelOffer
: public Transactor
{
public:
CancelOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CancelOffer"))
{
TER CancelOffer::doApply ()
}
TER doApply () override
{
std::uint32_t const uOfferSequence = mTxn.getFieldU32 (sfOfferSequence);
std::uint32_t const uAccountSequenceNext = mTxnAccount->getFieldU32 (sfSequence);
@@ -68,5 +84,15 @@ TER CancelOffer::doApply ()
return tesSUCCESS;
}
};
TER
transact_CancelOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return CancelOffer (txn, params, engine).apply ();
}
}

View File

@@ -1,57 +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_TX_OFFERCANCEL_H_INCLUDED
#define RIPPLE_TX_OFFERCANCEL_H_INCLUDED
namespace ripple {
class CancelOffer
: public Transactor
{
public:
CancelOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CancelOffer"))
{
}
TER doApply () override;
};
inline
std::unique_ptr <Transactor>
make_CancelOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <CancelOffer> (txn, params, engine);
}
}
#endif

View File

@@ -19,7 +19,23 @@
namespace ripple {
TER Change::doApply ()
class Change
: public Transactor
{
public:
Change (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("Change"))
{
}
TER doApply () override
{
if (mTxn.getTxnType () == ttAMENDMENT)
return applyAmendment ();
@@ -30,7 +46,7 @@ TER Change::doApply ()
return temUNKNOWN;
}
TER Change::checkSig ()
TER checkSig () override
{
if (mTxn.getFieldAccount160 (sfAccount).isNonZero ())
{
@@ -47,7 +63,7 @@ TER Change::checkSig ()
return tesSUCCESS;
}
TER Change::checkSeq ()
TER checkSeq () override
{
if ((mTxn.getSequence () != 0) || mTxn.isFieldPresent (sfPreviousTxnID))
{
@@ -58,7 +74,7 @@ TER Change::checkSeq ()
return tesSUCCESS;
}
TER Change::payFee ()
TER payFee () override
{
if (mTxn.getTransactionFee () != STAmount ())
{
@@ -69,7 +85,7 @@ TER Change::payFee ()
return tesSUCCESS;
}
TER Change::preCheck ()
TER preCheck () override
{
mTxnAccountID = mTxn.getSourceAccount ().getAccountID ();
@@ -89,7 +105,8 @@ TER Change::preCheck ()
return tesSUCCESS;
}
TER Change::applyAmendment ()
private:
TER applyAmendment ()
{
uint256 amendment (mTxn.getFieldH256 (sfAmendment));
@@ -119,7 +136,7 @@ TER Change::applyAmendment ()
return tesSUCCESS;
}
TER Change::applyFee ()
TER applyFee ()
{
SLE::pointer feeObject = mEngine->entryCache (
@@ -149,4 +166,21 @@ TER Change::applyFee ()
return tesSUCCESS;
}
// VFALCO TODO Can this be removed?
bool mustHaveValidAccount () override
{
return false;
}
};
TER
transact_Change (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return Change (txn, params, engine).apply ();
}
}

View File

@@ -1,71 +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_TX_CHANGE_H_INCLUDED
#define RIPPLE_TX_CHANGE_H_INCLUDED
namespace ripple {
class Change
: public Transactor
{
public:
Change (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("Change"))
{
}
TER doApply () override;
TER checkSig () override;
TER checkSeq () override;
TER payFee () override;
TER preCheck () override;
private:
TER applyAmendment ();
TER applyFee ();
// VFALCO TODO Can this be removed?
bool mustHaveValidAccount () override
{
return false;
}
};
inline
std::unique_ptr <Transactor>
make_Change (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <Change> (txn, params, engine);
}
}
#endif

View File

@@ -17,30 +17,25 @@
*/
//==============================================================================
#include <ripple/module/app/transactors/CreateOfferDirect.h>
#include <ripple/module/app/transactors/CreateOfferBridged.h>
#include <ripple/module/app/book/OfferStream.h>
#include <ripple/module/app/book/Taker.h>
#include <ripple/module/app/book/Types.h>
#include <ripple/module/app/book/Amounts.h>
#include <beast/cxx14/memory.h>
namespace ripple {
CreateOffer::CreateOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CreateOffer"))
class CreateOffer
: public Transactor
{
private:
// What kind of offer we are placing
bool autobridging_;
}
/** Determine if we are authorized to hold the asset we want to get */
TER
CreateOffer::checkAcceptAsset(IssueRef issue) const
checkAcceptAsset(IssueRef issue) const
{
/* Only valid for custom currencies */
assert (!isXRP (issue.currency));
@@ -94,8 +89,56 @@ CreateOffer::checkAcceptAsset(IssueRef issue) const
return tesSUCCESS;
}
/** Fill offer as much as possible by consuming offers already on the books.
We adjusts account balances and charges fees on top to taker.
@param taker_amount.in How much the taker offers
@param taker_amount.out How much the taker wants
@return result.first crossing operation success/failure indicator.
result.second amount of offer left unfilled - only meaningful
if result.first is tesSUCCESS.
*/
/** @{ */
std::pair<TER, core::Amounts> crossOffersBridged (
core::LedgerView& view,
core::Amounts const& taker_amount);
std::pair<TER, core::Amounts> crossOffersDirect (
core::LedgerView& view,
core::Amounts const& taker_amount);
std::pair<TER, core::Amounts> crossOffers (
core::LedgerView& view,
core::Amounts const& taker_amount)
{
#if RIPPLE_ENABLE_AUTOBRIDGING
if (autobridging_)
return crossOffersBridged (view, taker_amount);
#endif
return crossOffersDirect (view, taker_amount);
}
/** @} */
public:
CreateOffer (
bool autobridging,
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CreateOffer"))
, autobridging_ (autobridging)
{
}
TER
CreateOffer::doApply ()
doApply () override
{
if (m_journal.debug) m_journal.debug <<
"OfferCreate> " << mTxn.getJson (0);
@@ -532,22 +575,20 @@ CreateOffer::doApply ()
return terResult;
}
};
std::unique_ptr <Transactor> make_CreateOffer (
TER
transact_CreateOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
#if RIPPLE_ENABLE_AUTOBRIDGING
STAmount const& amount_in = txn.getFieldAmount (sfTakerPays);
STAmount const& amount_out = txn.getFieldAmount (sfTakerGets);
// Autobridging is performed only when the offer does not involve XRP
bool autobridging =
! txn.getFieldAmount (sfTakerPays).isNative() &&
! txn.getFieldAmount (sfTakerGets).isNative ();
// Autobridging is only in effect when an offer does not involve XRP
if (!amount_in.isNative() && !amount_out.isNative ())
return std::make_unique <CreateOfferBridged> (txn, params, engine);
#endif
return std::make_unique <CreateOfferDirect> (txn, params, engine);
return CreateOffer (autobridging, txn, params, engine).apply ();
}
}

View File

@@ -1,67 +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_TX_OFFERCREATE_H_INCLUDED
#define RIPPLE_TX_OFFERCREATE_H_INCLUDED
#include <ripple/module/app/book/Amounts.h>
#include <ripple/module/app/book/Types.h>
#include <beast/cxx14/memory.h>
namespace ripple {
class CreateOffer
: public Transactor
{
protected:
/** Determine if we are authorized to hold the asset we want to get */
TER checkAcceptAsset(IssueRef asset) const;
/** Fill offer as much as possible by consuming offers already on the books.
We adjusts account balances and charges fees on top to taker.
@param taker_amount.in How much the taker offers
@param taker_amount.out How much the taker wants
@return result.first crossing operation success/failure indicator.
result.second amount of offer left unfilled - only meaningful
if result.first is tesSUCCESS.
*/
virtual std::pair<TER, core::Amounts> crossOffers (
core::LedgerView& view,
core::Amounts const& taker_amount) = 0;
public:
CreateOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine);
TER doApply () override;
};
std::unique_ptr <Transactor> make_CreateOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine);
}
#endif

View File

@@ -25,7 +25,7 @@
namespace ripple {
std::pair<TER, core::Amounts>
CreateOfferBridged::crossOffers (
CreateOffer::crossOffersBridged (
core::LedgerView& view,
core::Amounts const& taker_amount)
{

View File

@@ -1,51 +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_TX_BRIDGE_OFFERCREATE_H_INCLUDED
#define RIPPLE_TX_BRIDGE_OFFERCREATE_H_INCLUDED
#include <ripple/module/app/book/Amounts.h>
namespace ripple {
class CreateOfferBridged
: public CreateOffer
{
public:
CreateOfferBridged (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: CreateOffer (
txn,
params,
engine)
{
}
private:
std::pair<TER, core::Amounts> crossOffers (
core::LedgerView& view,
core::Amounts const& taker_amount) override;
};
}
#endif

View File

@@ -23,19 +23,8 @@
namespace ripple {
/** Fill offer as much as possible by consuming offers already on the books.
We adjusts account balances and charges fees on top to taker.
@param taker_amount.in How much the taker offers
@param taker_amount.out How much the taker wants
@param taker_flow.in What the taker actually paid, not including fees.
@param taker_flow.out What the taker actually got, not including fees.
@return tesSUCCESS, terNO_ACCOUNT, telFAILED_PROCESSING, or
tecFAILED_PROCESSING
*/
std::pair<TER, core::Amounts>
CreateOfferDirect::crossOffers (
CreateOffer::crossOffersDirect (
core::LedgerView& view,
core::Amounts const& taker_amount)
{

View File

@@ -1,51 +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_TX_DIRECT_OFFERCREATE_H_INCLUDED
#define RIPPLE_TX_DIRECT_OFFERCREATE_H_INCLUDED
#include <ripple/module/app/book/Amounts.h>
namespace ripple {
class CreateOfferDirect
: public CreateOffer
{
public:
CreateOfferDirect (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: CreateOffer (
txn,
params,
engine)
{
}
private:
std::pair<TER, core::Amounts> crossOffers (
core::LedgerView& view,
core::Amounts const& taker_amount) override;
};
}
#endif

View File

@@ -21,7 +21,30 @@ namespace ripple {
// See https://ripple.com/wiki/Transaction_Format#Payment_.280.29
TER Payment::doApply ()
class Payment
: public Transactor
{
/* The largest number of paths we allow */
static std::size_t const MaxPathSize = 6;
/* The longest path we allow */
static std::size_t const MaxPathLength = 8;
public:
Payment (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("Payment"))
{
}
TER doApply () override
{
// Ripple if source or destination is non-native or if there are paths.
std::uint32_t const uTxFlags = mTxn.getFlags ();
@@ -345,5 +368,15 @@ TER Payment::doApply ()
return terResult;
}
};
TER
transact_Payment (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return Payment(txn, params, engine).apply ();
}
} // ripple

View File

@@ -1,63 +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_TX_PAYMENT_H_INCLUDED
#define RIPPLE_TX_PAYMENT_H_INCLUDED
namespace ripple {
class Payment
: public Transactor
{
/* The largest number of paths we allow */
static std::size_t const MaxPathSize = 6;
/* The longest path we allow */
static std::size_t const MaxPathLength = 8;
public:
Payment (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("Payment"))
{
}
TER doApply ();
};
inline
std::unique_ptr <Transactor>
make_Payment (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <Payment> (txn, params, engine);
}
}
#endif

View File

@@ -19,7 +19,24 @@
namespace ripple {
TER SetAccount::doApply ()
class SetAccount
: public Transactor
{
public:
SetAccount (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetAccount"))
{
}
TER doApply () override
{
std::uint32_t const uTxFlags = mTxn.getFlags ();
@@ -312,5 +329,15 @@ TER SetAccount::doApply ()
return tesSUCCESS;
}
};
TER
transact_SetAccount (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return SetAccount(txn, params, engine).apply ();
}
}

View File

@@ -1,57 +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_TX_ACCOUNTSET_H_INCLUDED
#define RIPPLE_TX_ACCOUNTSET_H_INCLUDED
namespace ripple {
class SetAccount
: public Transactor
{
public:
SetAccount (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetAccount"))
{
}
TER doApply () override;
};
inline
std::unique_ptr <Transactor>
make_SetAccount (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <SetAccount> (txn, params, engine);
}
}
#endif

View File

@@ -19,7 +19,10 @@
namespace ripple {
std::uint64_t SetRegularKey::calculateBaseFee ()
class SetRegularKey
: public Transactor
{
std::uint64_t calculateBaseFee () override
{
if ( mTxnAccount
&& (! (mTxnAccount->getFlags () & lsfPasswordSpent))
@@ -32,8 +35,21 @@ std::uint64_t SetRegularKey::calculateBaseFee ()
return Transactor::calculateBaseFee ();
}
public:
SetRegularKey (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetRegularKey"))
{
TER SetRegularKey::doApply ()
}
TER doApply () override
{
std::uint32_t const uTxFlags = mTxn.getFlags ();
@@ -64,5 +80,15 @@ TER SetRegularKey::doApply ()
return tesSUCCESS;
}
};
TER
transact_SetRegularKey (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return SetRegularKey(txn, params, engine).apply ();
}
}

View File

@@ -1,60 +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_TX_REGULARSETKEY_H_INCLUDED
#define RIPPLE_TX_REGULARSETKEY_H_INCLUDED
namespace ripple {
class SetRegularKey
: public Transactor
{
std::uint64_t calculateBaseFee ();
public:
SetRegularKey (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetRegularKey"))
{
}
TER checkFee ();
TER doApply ();
};
inline
std::unique_ptr <Transactor>
make_SetRegularKey (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <SetRegularKey> (txn, params, engine);
}
}
#endif

View File

@@ -19,7 +19,23 @@
namespace ripple {
TER SetTrust::doApply ()
class SetTrust
: public Transactor
{
public:
SetTrust (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetTrust"))
{
}
TER doApply () override
{
TER terResult = tesSUCCESS;
@@ -33,15 +49,30 @@ TER SetTrust::doApply ()
// true, iff current is high account.
bool const bHigh = mTxnAccountID > uDstAccountID;
std::uint32_t const uOwnerCount (mTxnAccount->getFieldU32 (sfOwnerCount));
// The reserve required to create the line. Note that we allow up to
// two trust lines without requiring a reserve because being able to
// exchange currencies is a powerful Ripple feature.
//
// This is also a security feature: if you're a gateway and you want to
// be able to let someone use your services, you would otherwise have to
// give them enough XRP to cover the incremental reserve for their trust
// line. If they had no intention of using your services, they could use
// the XRP for their own purposes. So we make it possible for gateways
// to fund accounts in a way where there's no incentive to trick them
// into creating an account you have no intention of using.
std::uint64_t const uReserveCreate = (uOwnerCount < 2)
? 0
: mEngine->getLedger ()->getReserve (uOwnerCount + 1);
std::uint32_t uQualityIn (bQualityIn ? mTxn.getFieldU32 (sfQualityIn) : 0);
std::uint32_t uQualityOut (bQualityOut ? mTxn.getFieldU32 (sfQualityOut) : 0);
if (!saLimitAmount.isLegalNet ())
return temBAD_AMOUNT;
if (bQualityIn && QUALITY_ONE == uQualityIn)
uQualityIn = 0;
if (bQualityOut && QUALITY_ONE == uQualityOut)
uQualityOut = 0;
@@ -124,13 +155,6 @@ TER SetTrust::doApply ()
return tecNO_DST;
}
std::uint32_t const uOwnerCount (mTxnAccount->getFieldU32 (sfOwnerCount));
// The reserve required to create the line.
std::uint64_t const uReserveCreate =
(uOwnerCount < 2)
? 0
: mEngine->getLedger ()->getReserve (uOwnerCount + 1);
STAmount saLimitAllow = saLimitAmount;
saLimitAllow.setIssuer (mTxnAccountID);
@@ -397,5 +421,15 @@ TER SetTrust::doApply ()
return terResult;
}
};
TER
transact_SetTrust (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return SetTrust (txn, params, engine).apply ();
}
}

View File

@@ -1,56 +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_TX_TRUSTSET_H_INCLUDED
#define RIPPLE_TX_TRUSTSET_H_INCLUDED
namespace ripple {
class SetTrust
: public Transactor
{
public:
SetTrust (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("SetTrust"))
{
}
TER doApply ();
};
inline
std::unique_ptr <Transactor>
make_SetTrust (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return std::make_unique <SetTrust> (txn, params, engine);
}
}
#endif

View File

@@ -18,18 +18,20 @@
//==============================================================================
#include <ripple/module/app/transactors/Transactor.h>
#include <ripple/module/app/transactors/AddWallet.h>
#include <ripple/module/app/transactors/CancelOffer.h>
#include <ripple/module/app/transactors/Change.h>
#include <ripple/module/app/transactors/CreateOffer.h>
#include <ripple/module/app/transactors/Payment.h>
#include <ripple/module/app/transactors/SetAccount.h>
#include <ripple/module/app/transactors/SetRegularKey.h>
#include <ripple/module/app/transactors/SetTrust.h>
namespace ripple {
std::unique_ptr<Transactor> Transactor::makeTransactor (
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
Transactor::transact (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
@@ -37,36 +39,35 @@ std::unique_ptr<Transactor> Transactor::makeTransactor (
switch (txn.getTxnType ())
{
case ttPAYMENT:
return make_Payment (txn, params, engine);
return transact_Payment (txn, params, engine);
case ttACCOUNT_SET:
return make_SetAccount (txn, params, engine);
return transact_SetAccount (txn, params, engine);
case ttREGULAR_KEY_SET:
return make_SetRegularKey (txn, params, engine);
return transact_SetRegularKey (txn, params, engine);
case ttTRUST_SET:
return make_SetTrust (txn, params, engine);
return transact_SetTrust (txn, params, engine);
case ttOFFER_CREATE:
return make_CreateOffer (txn, params, engine);
return transact_CreateOffer (txn, params, engine);
case ttOFFER_CANCEL:
return make_CancelOffer (txn, params, engine);
return transact_CancelOffer (txn, params, engine);
case ttWALLET_ADD:
return make_AddWallet (txn, params, engine);
return transact_AddWallet (txn, params, engine);
case ttAMENDMENT:
case ttFEE:
return make_Change (txn, params, engine);
return transact_Change (txn, params, engine);
default:
return std::unique_ptr<Transactor> ();
return temUNKNOWN;
}
}
Transactor::Transactor (
SerializedTransaction const& txn,
TransactionEngineParams params,

View File

@@ -25,12 +25,15 @@ namespace ripple {
class Transactor
{
public:
static std::unique_ptr<Transactor> makeTransactor (
static
TER
transact (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine);
TER apply ();
TER
apply ();
protected:
SerializedTransaction const& mTxn;

View File

@@ -70,7 +70,9 @@ void TransactionEngine::txnWrite ()
}
}
TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, TransactionEngineParams params,
TER TransactionEngine::applyTransaction (
SerializedTransaction const& txn,
TransactionEngineParams params,
bool& didApply)
{
WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>";
@@ -79,7 +81,6 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
mNodes.init (mLedger, txn.getTransactionID (), mLedger->getLedgerSeq (), params);
#ifdef BEAST_DEBUG
if (1)
{
Serializer ser;
@@ -89,39 +90,46 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
if (!s2.isEquivalent (txn))
{
WriteLog (lsFATAL, TransactionEngine) << "Transaction serdes mismatch";
WriteLog (lsFATAL, TransactionEngine) <<
"Transaction serdes mismatch";
Json::StyledStreamWriter ssw;
WriteLog (lsINFO, TransactionEngine) << txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) << s2.getJson (0);
assert (false);
}
}
#endif
uint256 txID = txn.getTransactionID ();
if (!txID)
{
WriteLog (lsWARNING, TransactionEngine) << "applyTransaction: invalid transaction id";
WriteLog (lsWARNING, TransactionEngine) <<
"applyTransaction: invalid transaction id";
return temINVALID;
}
std::unique_ptr<Transactor> transactor = Transactor::makeTransactor (txn, params, this);
TER terResult = Transactor::transact (txn, params, this);
if (transactor.get () == nullptr)
if (terResult == temUNKNOWN)
{
WriteLog (lsWARNING, TransactionEngine) << "applyTransaction: Invalid transaction: unknown transaction type";
WriteLog (lsWARNING, TransactionEngine) <<
"applyTransaction: Invalid transaction: unknown transaction type";
return temUNKNOWN;
}
TER terResult = transactor->apply ();
if (ShouldLog (lsINFO, TransactionEngine))
{
std::string strToken;
std::string strHuman;
transResultInfo (terResult, strToken, strHuman);
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman;
WriteLog (lsINFO, TransactionEngine) <<
"applyTransaction: terResult=" << strToken <<
" : " << terResult <<
" : " << strHuman;
}
if (isTesSuccess (terResult))
didApply = true;
@@ -131,7 +139,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
WriteLog (lsDEBUG, TransactionEngine) << "Reprocessing to only claim fee";
mNodes.clear ();
SLE::pointer txnAcct = entryCache (ltACCOUNT_ROOT, Ledger::getAccountRootIndex (txn.getSourceAccount ()));
SLE::pointer txnAcct = entryCache (ltACCOUNT_ROOT,
Ledger::getAccountRootIndex (txn.getSourceAccount ()));
if (!txnAcct)
terResult = terNO_ACCOUNT;
@@ -177,16 +186,21 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{
if (!checkInvariants (terResult, txn, params))
{
WriteLog (lsFATAL, TransactionEngine) << "Transaction violates invariants";
WriteLog (lsFATAL, TransactionEngine) << txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) << transToken (terResult) << ": " << transHuman (terResult);
WriteLog (lsFATAL, TransactionEngine) << mNodes.getJson (0);
WriteLog (lsFATAL, TransactionEngine) <<
"Transaction violates invariants";
WriteLog (lsFATAL, TransactionEngine) <<
txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) <<
transToken (terResult) << ": " << transHuman (terResult);
WriteLog (lsFATAL, TransactionEngine) <<
mNodes.getJson (0);
didApply = false;
terResult = tefINTERNAL;
}
else
{
// Transaction succeeded fully or (retries are not allowed and the transaction could claim a fee)
// Transaction succeeded fully or (retries are not allowed and the
// transaction could claim a fee)
Serializer m;
mNodes.calcRawMeta (m, terResult, mTxnSeq++);
@@ -199,7 +213,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{
if (!mLedger->addTransaction (txID, s))
{
WriteLog (lsFATAL, TransactionEngine) << "Tried to add transaction to open ledger that already had it";
WriteLog (lsFATAL, TransactionEngine) <<
"Tried to add transaction to open ledger that already had it";
assert (false);
throw std::runtime_error ("Duplicate transaction applied");
}
@@ -208,7 +223,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{
if (!mLedger->addTransaction (txID, s, m))
{
WriteLog (lsFATAL, TransactionEngine) << "Tried to add transaction to ledger that already had it";
WriteLog (lsFATAL, TransactionEngine) <<
"Tried to add transaction to ledger that already had it";
assert (false);
throw std::runtime_error ("Duplicate transaction applied to closed ledger");
}