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> </ClCompile>
<ClInclude Include="..\..\build\proto\ripple.pb.h"> <ClInclude Include="..\..\build\proto\ripple.pb.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h"> <ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\beast\beast\asio\abstract_socket.cpp"> <ClCompile Include="..\..\src\beast\beast\asio\abstract_socket.cpp">
@@ -304,14 +302,14 @@
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h"> <ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -826,14 +824,6 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h"> <ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
</ClInclude> </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"> <ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -846,6 +836,14 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h"> <ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
</ClInclude> </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"> <ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -1188,6 +1186,8 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\beast\beast\Version.h"> <ClInclude Include="..\..\src\beast\beast\Version.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
</ClInclude>
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc"> <ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -2386,53 +2386,33 @@
<ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\AddWallet.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CancelOffer.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CancelOffer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CancelOffer.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Change.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Change.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Change.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOffer.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOffer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOffer.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Payment.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Payment.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\Payment.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetAccount.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetAccount.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetAccount.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetRegularKey.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetRegularKey.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetRegularKey.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\SetTrust.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetTrust.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\app\transactors\SetTrust.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\app\transactors\Transactor.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Transactor.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -3943,57 +3923,6 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h"> <ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h">
</ClInclude> </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"> <ClCompile Include="..\..\src\rocksdb2\util\arena.cc">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -4167,6 +4096,57 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\rocksdb2\util\xxhash.h"> <ClInclude Include="..\..\src\rocksdb2\util\xxhash.h">
</ClInclude> </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 Include="..\..\src\snappy\config\snappy-stubs-public.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\snappy\snappy\snappy-internal.h"> <ClInclude Include="..\..\src\snappy\snappy\snappy-internal.h">

View File

@@ -666,9 +666,6 @@
<ClInclude Include="..\..\build\proto\ripple.pb.h"> <ClInclude Include="..\..\build\proto\ripple.pb.h">
<Filter>build\proto</Filter> <Filter>build\proto</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
<Filter>.</Filter>
</ClInclude>
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h"> <ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
<Filter>beast</Filter> <Filter>beast</Filter>
</ClInclude> </ClInclude>
@@ -900,15 +897,15 @@
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
<Filter>beast\crypto\impl</Filter> <Filter>beast\crypto\impl</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
<Filter>beast\crypto\impl\sha2</Filter> <Filter>beast\crypto\impl\sha2</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h"> <ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
<Filter>beast\crypto\impl\sha2</Filter> <Filter>beast\crypto\impl\sha2</Filter>
</ClInclude> </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"> <ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
<Filter>beast\crypto\impl</Filter> <Filter>beast\crypto\impl</Filter>
</ClCompile> </ClCompile>
@@ -1554,18 +1551,6 @@
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h"> <ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
<Filter>beast\module\core\text</Filter> <Filter>beast\module\core\text</Filter>
</ClInclude> </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"> <ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
<Filter>beast\module\core\thread</Filter> <Filter>beast\module\core\thread</Filter>
</ClCompile> </ClCompile>
@@ -1581,6 +1566,18 @@
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h"> <ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
<Filter>beast\module\core\thread</Filter> <Filter>beast\module\core\thread</Filter>
</ClInclude> </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"> <ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
<Filter>beast\module\core\time</Filter> <Filter>beast\module\core\time</Filter>
</ClCompile> </ClCompile>
@@ -2019,6 +2016,9 @@
<ClInclude Include="..\..\src\beast\beast\Version.h"> <ClInclude Include="..\..\src\beast\beast\Version.h">
<Filter>beast</Filter> <Filter>beast</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\BeastConfig.h">
<Filter>.</Filter>
</ClInclude>
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc"> <ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
<Filter>hyperleveldb\db</Filter> <Filter>hyperleveldb\db</Filter>
</ClCompile> </ClCompile>
@@ -3489,63 +3489,33 @@
<ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp"> <ClCompile Include="..\..\src\ripple\module\app\transactors\AddWallet.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CancelOffer.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Change.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOffer.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferBridged.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\CreateOfferDirect.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Payment.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetAccount.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetRegularKey.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\SetTrust.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\module\app\transactors\Transactor.cpp">
<Filter>ripple\module\app\transactors</Filter> <Filter>ripple\module\app\transactors</Filter>
</ClCompile> </ClCompile>
@@ -5412,66 +5382,6 @@
<ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h"> <ClInclude Include="..\..\src\rocksdb2\third-party\rapidjson\reader.h">
<Filter>rocksdb2\third-party\rapidjson</Filter> <Filter>rocksdb2\third-party\rapidjson</Filter>
</ClInclude> </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"> <ClCompile Include="..\..\src\rocksdb2\util\arena.cc">
<Filter>rocksdb2\util</Filter> <Filter>rocksdb2\util</Filter>
</ClCompile> </ClCompile>
@@ -5676,6 +5586,66 @@
<ClInclude Include="..\..\src\rocksdb2\util\xxhash.h"> <ClInclude Include="..\..\src\rocksdb2\util\xxhash.h">
<Filter>rocksdb2\util</Filter> <Filter>rocksdb2\util</Filter>
</ClInclude> </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"> <ClInclude Include="..\..\src\snappy\config\snappy-stubs-public.h">
<Filter>snappy\config</Filter> <Filter>snappy\config</Filter>
</ClInclude> </ClInclude>

View File

@@ -19,8 +19,24 @@
namespace ripple { 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 (); std::uint32_t const uTxFlags = mTxn.getFlags ();
if (uTxFlags & tfUniversalMask) if (uTxFlags & tfUniversalMask)
@@ -97,6 +113,16 @@ TER AddWallet::doApply ()
sleDst->setFieldAccount (sfRegularKey, uAuthKeyID); sleDst->setFieldAccount (sfRegularKey, uAuthKeyID);
return tesSUCCESS; 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,9 +19,25 @@
namespace ripple { namespace ripple {
class CancelOffer
TER CancelOffer::doApply () : public Transactor
{ {
public:
CancelOffer (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CancelOffer"))
{
}
TER doApply () override
{
std::uint32_t const uOfferSequence = mTxn.getFieldU32 (sfOfferSequence); std::uint32_t const uOfferSequence = mTxn.getFieldU32 (sfOfferSequence);
std::uint32_t const uAccountSequenceNext = mTxnAccount->getFieldU32 (sfSequence); std::uint32_t const uAccountSequenceNext = mTxnAccount->getFieldU32 (sfSequence);
@@ -67,6 +83,16 @@ TER CancelOffer::doApply ()
" : " << to_string (offerIndex); " : " << to_string (offerIndex);
return tesSUCCESS; 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,8 +19,24 @@
namespace ripple { 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) if (mTxn.getTxnType () == ttAMENDMENT)
return applyAmendment (); return applyAmendment ();
@@ -28,10 +44,10 @@ TER Change::doApply ()
return applyFee (); return applyFee ();
return temUNKNOWN; return temUNKNOWN;
} }
TER Change::checkSig () TER checkSig () override
{ {
if (mTxn.getFieldAccount160 (sfAccount).isNonZero ()) if (mTxn.getFieldAccount160 (sfAccount).isNonZero ())
{ {
m_journal.warning << "Bad source account"; m_journal.warning << "Bad source account";
@@ -45,10 +61,10 @@ TER Change::checkSig ()
} }
return tesSUCCESS; return tesSUCCESS;
} }
TER Change::checkSeq () TER checkSeq () override
{ {
if ((mTxn.getSequence () != 0) || mTxn.isFieldPresent (sfPreviousTxnID)) if ((mTxn.getSequence () != 0) || mTxn.isFieldPresent (sfPreviousTxnID))
{ {
m_journal.warning << "Bad sequence"; m_journal.warning << "Bad sequence";
@@ -56,10 +72,10 @@ TER Change::checkSeq ()
} }
return tesSUCCESS; return tesSUCCESS;
} }
TER Change::payFee () TER payFee () override
{ {
if (mTxn.getTransactionFee () != STAmount ()) if (mTxn.getTransactionFee () != STAmount ())
{ {
m_journal.warning << "Non-zero fee"; m_journal.warning << "Non-zero fee";
@@ -67,10 +83,10 @@ TER Change::payFee ()
} }
return tesSUCCESS; return tesSUCCESS;
} }
TER Change::preCheck () TER preCheck () override
{ {
mTxnAccountID = mTxn.getSourceAccount ().getAccountID (); mTxnAccountID = mTxn.getSourceAccount ().getAccountID ();
if (mTxnAccountID.isNonZero ()) if (mTxnAccountID.isNonZero ())
@@ -87,10 +103,11 @@ TER Change::preCheck ()
} }
return tesSUCCESS; return tesSUCCESS;
} }
TER Change::applyAmendment () private:
{ TER applyAmendment ()
{
uint256 amendment (mTxn.getFieldH256 (sfAmendment)); uint256 amendment (mTxn.getFieldH256 (sfAmendment));
SLE::pointer amendmentObject (mEngine->entryCache ( SLE::pointer amendmentObject (mEngine->entryCache (
@@ -117,10 +134,10 @@ TER Change::applyAmendment ()
getApp().getOPs ().setAmendmentBlocked (); getApp().getOPs ().setAmendmentBlocked ();
return tesSUCCESS; return tesSUCCESS;
} }
TER Change::applyFee () TER applyFee ()
{ {
SLE::pointer feeObject = mEngine->entryCache ( SLE::pointer feeObject = mEngine->entryCache (
ltFEE_SETTINGS, Ledger::getLedgerFeeIndex ()); ltFEE_SETTINGS, Ledger::getLedgerFeeIndex ());
@@ -147,6 +164,23 @@ TER Change::applyFee ()
"New fee object: " << feeObject->getJson (0); "New fee object: " << feeObject->getJson (0);
m_journal.warning << "Fees have been changed"; m_journal.warning << "Fees have been changed";
return tesSUCCESS; 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,31 +17,26 @@
*/ */
//============================================================================== //==============================================================================
#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/OfferStream.h>
#include <ripple/module/app/book/Taker.h> #include <ripple/module/app/book/Taker.h>
#include <ripple/module/app/book/Types.h> #include <ripple/module/app/book/Types.h>
#include <ripple/module/app/book/Amounts.h>
#include <beast/cxx14/memory.h>
namespace ripple { namespace ripple {
CreateOffer::CreateOffer ( class CreateOffer
SerializedTransaction const& txn, : public Transactor
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("CreateOffer"))
{ {
private:
// What kind of offer we are placing
bool autobridging_;
} /** Determine if we are authorized to hold the asset we want to get */
TER
TER checkAcceptAsset(IssueRef issue) const
CreateOffer::checkAcceptAsset(IssueRef issue) const {
{
/* Only valid for custom currencies */ /* Only valid for custom currencies */
assert (!isXRP (issue.currency)); assert (!isXRP (issue.currency));
@@ -92,11 +87,59 @@ CreateOffer::checkAcceptAsset(IssueRef issue) const
} }
return tesSUCCESS; return tesSUCCESS;
} }
TER /** Fill offer as much as possible by consuming offers already on the books.
CreateOffer::doApply () 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
doApply () override
{
if (m_journal.debug) m_journal.debug << if (m_journal.debug) m_journal.debug <<
"OfferCreate> " << mTxn.getJson (0); "OfferCreate> " << mTxn.getJson (0);
@@ -531,23 +574,21 @@ CreateOffer::doApply ()
} }
return terResult; return terResult;
} }
};
std::unique_ptr <Transactor> make_CreateOffer ( TER
transact_CreateOffer (
SerializedTransaction const& txn, SerializedTransaction const& txn,
TransactionEngineParams params, TransactionEngineParams params,
TransactionEngine* engine) TransactionEngine* engine)
{ {
#if RIPPLE_ENABLE_AUTOBRIDGING // Autobridging is performed only when the offer does not involve XRP
STAmount const& amount_in = txn.getFieldAmount (sfTakerPays); bool autobridging =
STAmount const& amount_out = txn.getFieldAmount (sfTakerGets); ! txn.getFieldAmount (sfTakerPays).isNative() &&
! txn.getFieldAmount (sfTakerGets).isNative ();
// Autobridging is only in effect when an offer does not involve XRP return CreateOffer (autobridging, txn, params, engine).apply ();
if (!amount_in.isNative() && !amount_out.isNative ())
return std::make_unique <CreateOfferBridged> (txn, params, engine);
#endif
return std::make_unique <CreateOfferDirect> (txn, params, engine);
} }
} }

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 { namespace ripple {
std::pair<TER, core::Amounts> std::pair<TER, core::Amounts>
CreateOfferBridged::crossOffers ( CreateOffer::crossOffersBridged (
core::LedgerView& view, core::LedgerView& view,
core::Amounts const& taker_amount) 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 { 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> std::pair<TER, core::Amounts>
CreateOfferDirect::crossOffers ( CreateOffer::crossOffersDirect (
core::LedgerView& view, core::LedgerView& view,
core::Amounts const& taker_amount) 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,8 +21,31 @@ namespace ripple {
// See https://ripple.com/wiki/Transaction_Format#Payment_.280.29 // 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. // Ripple if source or destination is non-native or if there are paths.
std::uint32_t const uTxFlags = mTxn.getFlags (); std::uint32_t const uTxFlags = mTxn.getFlags ();
bool const partialPaymentAllowed = uTxFlags & tfPartialPayment; bool const partialPaymentAllowed = uTxFlags & tfPartialPayment;
@@ -344,6 +367,16 @@ TER Payment::doApply ()
} }
return terResult; return terResult;
}
};
TER
transact_Payment (
SerializedTransaction const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return Payment(txn, params, engine).apply ();
} }
} // ripple } // 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,8 +19,25 @@
namespace ripple { 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 (); std::uint32_t const uTxFlags = mTxn.getFlags ();
std::uint32_t const uFlagsIn = mTxnAccount->getFieldU32 (sfFlags); std::uint32_t const uFlagsIn = mTxnAccount->getFieldU32 (sfFlags);
@@ -311,6 +328,16 @@ TER SetAccount::doApply ()
mTxnAccount->setFieldU32 (sfFlags, uFlagsOut); mTxnAccount->setFieldU32 (sfFlags, uFlagsOut);
return tesSUCCESS; 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,8 +19,11 @@
namespace ripple { namespace ripple {
std::uint64_t SetRegularKey::calculateBaseFee () class SetRegularKey
: public Transactor
{ {
std::uint64_t calculateBaseFee () override
{
if ( mTxnAccount if ( mTxnAccount
&& (! (mTxnAccount->getFlags () & lsfPasswordSpent)) && (! (mTxnAccount->getFlags () & lsfPasswordSpent))
&& (mSigningPubKey.getAccountID () == mTxnAccountID)) && (mSigningPubKey.getAccountID () == mTxnAccountID))
@@ -30,11 +33,24 @@ std::uint64_t SetRegularKey::calculateBaseFee ()
} }
return Transactor::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 (); std::uint32_t const uTxFlags = mTxn.getFlags ();
if (uTxFlags & tfUniversalMask) if (uTxFlags & tfUniversalMask)
@@ -63,6 +79,16 @@ TER SetRegularKey::doApply ()
} }
return tesSUCCESS; 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,8 +19,24 @@
namespace ripple { 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; TER terResult = tesSUCCESS;
STAmount const saLimitAmount (mTxn.getFieldAmount (sfLimitAmount)); STAmount const saLimitAmount (mTxn.getFieldAmount (sfLimitAmount));
@@ -33,15 +49,30 @@ TER SetTrust::doApply ()
// true, iff current is high account. // true, iff current is high account.
bool const bHigh = mTxnAccountID > uDstAccountID; 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 uQualityIn (bQualityIn ? mTxn.getFieldU32 (sfQualityIn) : 0);
std::uint32_t uQualityOut (bQualityOut ? mTxn.getFieldU32 (sfQualityOut) : 0); std::uint32_t uQualityOut (bQualityOut ? mTxn.getFieldU32 (sfQualityOut) : 0);
if (!saLimitAmount.isLegalNet ()) if (!saLimitAmount.isLegalNet ())
return temBAD_AMOUNT; return temBAD_AMOUNT;
if (bQualityIn && QUALITY_ONE == uQualityIn)
uQualityIn = 0;
if (bQualityOut && QUALITY_ONE == uQualityOut) if (bQualityOut && QUALITY_ONE == uQualityOut)
uQualityOut = 0; uQualityOut = 0;
@@ -124,13 +155,6 @@ TER SetTrust::doApply ()
return tecNO_DST; 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; STAmount saLimitAllow = saLimitAmount;
saLimitAllow.setIssuer (mTxnAccountID); saLimitAllow.setIssuer (mTxnAccountID);
@@ -396,6 +420,16 @@ TER SetTrust::doApply ()
} }
return terResult; 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/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 { 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, SerializedTransaction const& txn,
TransactionEngineParams params, TransactionEngineParams params,
TransactionEngine* engine) TransactionEngine* engine)
@@ -37,36 +39,35 @@ std::unique_ptr<Transactor> Transactor::makeTransactor (
switch (txn.getTxnType ()) switch (txn.getTxnType ())
{ {
case ttPAYMENT: case ttPAYMENT:
return make_Payment (txn, params, engine); return transact_Payment (txn, params, engine);
case ttACCOUNT_SET: case ttACCOUNT_SET:
return make_SetAccount (txn, params, engine); return transact_SetAccount (txn, params, engine);
case ttREGULAR_KEY_SET: case ttREGULAR_KEY_SET:
return make_SetRegularKey (txn, params, engine); return transact_SetRegularKey (txn, params, engine);
case ttTRUST_SET: case ttTRUST_SET:
return make_SetTrust (txn, params, engine); return transact_SetTrust (txn, params, engine);
case ttOFFER_CREATE: case ttOFFER_CREATE:
return make_CreateOffer (txn, params, engine); return transact_CreateOffer (txn, params, engine);
case ttOFFER_CANCEL: case ttOFFER_CANCEL:
return make_CancelOffer (txn, params, engine); return transact_CancelOffer (txn, params, engine);
case ttWALLET_ADD: case ttWALLET_ADD:
return make_AddWallet (txn, params, engine); return transact_AddWallet (txn, params, engine);
case ttAMENDMENT: case ttAMENDMENT:
case ttFEE: case ttFEE:
return make_Change (txn, params, engine); return transact_Change (txn, params, engine);
default: default:
return std::unique_ptr<Transactor> (); return temUNKNOWN;
} }
} }
Transactor::Transactor ( Transactor::Transactor (
SerializedTransaction const& txn, SerializedTransaction const& txn,
TransactionEngineParams params, TransactionEngineParams params,

View File

@@ -25,12 +25,15 @@ namespace ripple {
class Transactor class Transactor
{ {
public: public:
static std::unique_ptr<Transactor> makeTransactor ( static
TER
transact (
SerializedTransaction const& txn, SerializedTransaction const& txn,
TransactionEngineParams params, TransactionEngineParams params,
TransactionEngine* engine); TransactionEngine* engine);
TER apply (); TER
apply ();
protected: protected:
SerializedTransaction const& mTxn; 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) bool& didApply)
{ {
WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>"; WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>";
@@ -79,7 +81,6 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
mNodes.init (mLedger, txn.getTransactionID (), mLedger->getLedgerSeq (), params); mNodes.init (mLedger, txn.getTransactionID (), mLedger->getLedgerSeq (), params);
#ifdef BEAST_DEBUG #ifdef BEAST_DEBUG
if (1) if (1)
{ {
Serializer ser; Serializer ser;
@@ -89,39 +90,46 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
if (!s2.isEquivalent (txn)) if (!s2.isEquivalent (txn))
{ {
WriteLog (lsFATAL, TransactionEngine) << "Transaction serdes mismatch"; WriteLog (lsFATAL, TransactionEngine) <<
"Transaction serdes mismatch";
Json::StyledStreamWriter ssw; Json::StyledStreamWriter ssw;
WriteLog (lsINFO, TransactionEngine) << txn.getJson (0); WriteLog (lsINFO, TransactionEngine) << txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) << s2.getJson (0); WriteLog (lsFATAL, TransactionEngine) << s2.getJson (0);
assert (false); assert (false);
} }
} }
#endif #endif
uint256 txID = txn.getTransactionID (); uint256 txID = txn.getTransactionID ();
if (!txID) if (!txID)
{ {
WriteLog (lsWARNING, TransactionEngine) << "applyTransaction: invalid transaction id"; WriteLog (lsWARNING, TransactionEngine) <<
"applyTransaction: invalid transaction id";
return temINVALID; 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; return temUNKNOWN;
} }
TER terResult = transactor->apply (); if (ShouldLog (lsINFO, TransactionEngine))
{
std::string strToken; std::string strToken;
std::string strHuman; std::string strHuman;
transResultInfo (terResult, strToken, strHuman); transResultInfo (terResult, strToken, strHuman);
WriteLog (lsINFO, TransactionEngine) << "applyTransaction: terResult=" << strToken << " : " << terResult << " : " << strHuman; WriteLog (lsINFO, TransactionEngine) <<
"applyTransaction: terResult=" << strToken <<
" : " << terResult <<
" : " << strHuman;
}
if (isTesSuccess (terResult)) if (isTesSuccess (terResult))
didApply = true; didApply = true;
@@ -131,7 +139,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
WriteLog (lsDEBUG, TransactionEngine) << "Reprocessing to only claim fee"; WriteLog (lsDEBUG, TransactionEngine) << "Reprocessing to only claim fee";
mNodes.clear (); mNodes.clear ();
SLE::pointer txnAcct = entryCache (ltACCOUNT_ROOT, Ledger::getAccountRootIndex (txn.getSourceAccount ())); SLE::pointer txnAcct = entryCache (ltACCOUNT_ROOT,
Ledger::getAccountRootIndex (txn.getSourceAccount ()));
if (!txnAcct) if (!txnAcct)
terResult = terNO_ACCOUNT; terResult = terNO_ACCOUNT;
@@ -177,16 +186,21 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{ {
if (!checkInvariants (terResult, txn, params)) if (!checkInvariants (terResult, txn, params))
{ {
WriteLog (lsFATAL, TransactionEngine) << "Transaction violates invariants"; WriteLog (lsFATAL, TransactionEngine) <<
WriteLog (lsFATAL, TransactionEngine) << txn.getJson (0); "Transaction violates invariants";
WriteLog (lsFATAL, TransactionEngine) << transToken (terResult) << ": " << transHuman (terResult); WriteLog (lsFATAL, TransactionEngine) <<
WriteLog (lsFATAL, TransactionEngine) << mNodes.getJson (0); txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) <<
transToken (terResult) << ": " << transHuman (terResult);
WriteLog (lsFATAL, TransactionEngine) <<
mNodes.getJson (0);
didApply = false; didApply = false;
terResult = tefINTERNAL; terResult = tefINTERNAL;
} }
else 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; Serializer m;
mNodes.calcRawMeta (m, terResult, mTxnSeq++); mNodes.calcRawMeta (m, terResult, mTxnSeq++);
@@ -199,7 +213,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{ {
if (!mLedger->addTransaction (txID, s)) 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); assert (false);
throw std::runtime_error ("Duplicate transaction applied"); throw std::runtime_error ("Duplicate transaction applied");
} }
@@ -208,7 +223,8 @@ TER TransactionEngine::applyTransaction (const SerializedTransaction& txn, Trans
{ {
if (!mLedger->addTransaction (txID, s, m)) 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); assert (false);
throw std::runtime_error ("Duplicate transaction applied to closed ledger"); throw std::runtime_error ("Duplicate transaction applied to closed ledger");
} }