Various tidying:

* Fix unused variable warnings.
* Clean unused items from TER.
* Improvement to LES use of shared_ptr.
This commit is contained in:
Tom Ritchford
2014-07-09 14:36:23 -04:00
committed by Vinnie Falco
parent 4d49d272eb
commit d7e08f96a5
7 changed files with 153 additions and 85 deletions

View File

@@ -2585,6 +2585,8 @@
<ClCompile Include="..\..\src\ripple\module\data\protocol\STAmount.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\STAmount.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\data\protocol\STAmount.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\data\protocol\STAmountRound.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\STAmountRound.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -2605,6 +2607,8 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedObjectTemplate.h"> <ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedObjectTemplate.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedType.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\data\protocol\SerializedTypes.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\SerializedTypes.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -3327,6 +3331,8 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\Blob.h"> <ClInclude Include="..\..\src\ripple\types\api\Blob.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\Book.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h"> <ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifier.h"> <ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifier.h">
@@ -3337,6 +3343,8 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h"> <ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\Issue.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h"> <ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h">
@@ -3345,8 +3353,6 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleAssets.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RipplePrivateKey.h"> <ClInclude Include="..\..\src\ripple\types\api\RipplePrivateKey.h">
@@ -3371,10 +3377,10 @@
<ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\Issue.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleAssets.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp">
@@ -3723,6 +3729,8 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\flush_block_policy.h"> <ClInclude Include="..\..\src\rocksdb\include\rocksdb\flush_block_policy.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\iostats_context.h">
</ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\iterator.h"> <ClInclude Include="..\..\src\rocksdb\include\rocksdb\iterator.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\memtablerep.h"> <ClInclude Include="..\..\src\rocksdb\include\rocksdb\memtablerep.h">
@@ -3796,6 +3804,11 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\block_hash_index.h"> <ClInclude Include="..\..\src\rocksdb\table\block_hash_index.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\block_prefix_index.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\block_prefix_index.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\filter_block.cc"> <ClCompile Include="..\..\src\rocksdb\table\filter_block.cc">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -3836,6 +3849,11 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\plain_table_factory.h"> <ClInclude Include="..\..\src\rocksdb\table\plain_table_factory.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\plain_table_key_coding.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\plain_table_key_coding.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\plain_table_reader.cc"> <ClCompile Include="..\..\src\rocksdb\table\plain_table_reader.cc">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -3930,6 +3948,11 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\rocksdb\util\histogram.h"> <ClInclude Include="..\..\src\rocksdb\util\histogram.h">
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\util\iostats_context.cc">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\util\iostats_context_imp.h">
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\util\log_buffer.cc"> <ClCompile Include="..\..\src\rocksdb\util\log_buffer.cc">
<ExcludedFromBuild>True</ExcludedFromBuild> <ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile> </ClCompile>

View File

@@ -3690,6 +3690,9 @@
<ClCompile Include="..\..\src\ripple\module\data\protocol\STAmount.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\STAmount.cpp">
<Filter>ripple\module\data\protocol</Filter> <Filter>ripple\module\data\protocol</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\module\data\protocol\STAmount.h">
<Filter>ripple\module\data\protocol</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\data\protocol\STAmountRound.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\STAmountRound.cpp">
<Filter>ripple\module\data\protocol</Filter> <Filter>ripple\module\data\protocol</Filter>
</ClCompile> </ClCompile>
@@ -3714,6 +3717,9 @@
<ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedObjectTemplate.h"> <ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedObjectTemplate.h">
<Filter>ripple\module\data\protocol</Filter> <Filter>ripple\module\data\protocol</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\module\data\protocol\SerializedType.h">
<Filter>ripple\module\data\protocol</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\module\data\protocol\SerializedTypes.cpp"> <ClCompile Include="..\..\src\ripple\module\data\protocol\SerializedTypes.cpp">
<Filter>ripple\module\data\protocol</Filter> <Filter>ripple\module\data\protocol</Filter>
</ClCompile> </ClCompile>
@@ -4572,6 +4578,9 @@
<ClInclude Include="..\..\src\ripple\types\api\Blob.h"> <ClInclude Include="..\..\src\ripple\types\api\Blob.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\Book.h">
<Filter>ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h"> <ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
@@ -4587,6 +4596,9 @@
<ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h"> <ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\Issue.h">
<Filter>ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h"> <ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
@@ -4599,9 +4611,6 @@
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleAssets.h">
<Filter>ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h">
<Filter>ripple\types\api</Filter> <Filter>ripple\types\api</Filter>
</ClInclude> </ClInclude>
@@ -4635,10 +4644,10 @@
<ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp">
<Filter>ripple\types\impl</Filter> <Filter>ripple\types\impl</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\Issue.cpp">
<Filter>ripple\types\impl</Filter> <Filter>ripple\types\impl</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleAssets.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp">
<Filter>ripple\types\impl</Filter> <Filter>ripple\types\impl</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp">
@@ -5085,6 +5094,9 @@
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\flush_block_policy.h"> <ClInclude Include="..\..\src\rocksdb\include\rocksdb\flush_block_policy.h">
<Filter>rocksdb\include\rocksdb</Filter> <Filter>rocksdb\include\rocksdb</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\iostats_context.h">
<Filter>rocksdb\include\rocksdb</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rocksdb\include\rocksdb\iterator.h"> <ClInclude Include="..\..\src\rocksdb\include\rocksdb\iterator.h">
<Filter>rocksdb\include\rocksdb</Filter> <Filter>rocksdb\include\rocksdb</Filter>
</ClInclude> </ClInclude>
@@ -5184,6 +5196,12 @@
<ClInclude Include="..\..\src\rocksdb\table\block_hash_index.h"> <ClInclude Include="..\..\src\rocksdb\table\block_hash_index.h">
<Filter>rocksdb\table</Filter> <Filter>rocksdb\table</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\block_prefix_index.cc">
<Filter>rocksdb\table</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\block_prefix_index.h">
<Filter>rocksdb\table</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\filter_block.cc"> <ClCompile Include="..\..\src\rocksdb\table\filter_block.cc">
<Filter>rocksdb\table</Filter> <Filter>rocksdb\table</Filter>
</ClCompile> </ClCompile>
@@ -5232,6 +5250,12 @@
<ClInclude Include="..\..\src\rocksdb\table\plain_table_factory.h"> <ClInclude Include="..\..\src\rocksdb\table\plain_table_factory.h">
<Filter>rocksdb\table</Filter> <Filter>rocksdb\table</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\plain_table_key_coding.cc">
<Filter>rocksdb\table</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\table\plain_table_key_coding.h">
<Filter>rocksdb\table</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\table\plain_table_reader.cc"> <ClCompile Include="..\..\src\rocksdb\table\plain_table_reader.cc">
<Filter>rocksdb\table</Filter> <Filter>rocksdb\table</Filter>
</ClCompile> </ClCompile>
@@ -5343,6 +5367,12 @@
<ClInclude Include="..\..\src\rocksdb\util\histogram.h"> <ClInclude Include="..\..\src\rocksdb\util\histogram.h">
<Filter>rocksdb\util</Filter> <Filter>rocksdb\util</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\rocksdb\util\iostats_context.cc">
<Filter>rocksdb\util</Filter>
</ClCompile>
<ClInclude Include="..\..\src\rocksdb\util\iostats_context_imp.h">
<Filter>rocksdb\util</Filter>
</ClInclude>
<ClCompile Include="..\..\src\rocksdb\util\log_buffer.cc"> <ClCompile Include="..\..\src\rocksdb\util\log_buffer.cc">
<Filter>rocksdb\util</Filter> <Filter>rocksdb\util</Filter>
</ClCompile> </ClCompile>

View File

@@ -72,8 +72,9 @@ message_parser::check_url()
{ {
checked_url_ = true; checked_url_ = true;
auto const p (reinterpret_cast <joyent::http_parser const*> (&state_)); auto const p (reinterpret_cast <joyent::http_parser const*> (&state_));
ec_ = on_request (joyent::convert_http_method ( ec_ = on_request (
joyent::http_method(p->method)), p->http_major, p->http_minor, url_); joyent::convert_http_method (joyent::http_method(p->method)),
p->http_major, p->http_minor, url_);
if (ec_) if (ec_)
return 1; return 1;
} }
@@ -96,7 +97,6 @@ message_parser::do_url (char const* in, std::size_t bytes)
int int
message_parser::do_status (char const* in, std::size_t bytes) message_parser::do_status (char const* in, std::size_t bytes)
{ {
auto const p (reinterpret_cast <joyent::http_parser const*> (&state_));
return ec_ ? 1 : 0; return ec_ ? 1 : 0;
} }
@@ -132,8 +132,6 @@ message_parser::do_headers_done ()
{ {
if (check_url()) if (check_url())
return 1; return 1;
auto const p (reinterpret_cast <joyent::http_parser const*> (&state_));
bool const keep_alive (joyent::http_should_keep_alive (p) != 0);
if (! value_.empty()) if (! value_.empty())
{ {
ec_ = on_field (field_, value_); ec_ = on_field (field_, value_);
@@ -148,17 +146,12 @@ message_parser::do_headers_done ()
int int
message_parser::do_body (char const* in, std::size_t bytes) message_parser::do_body (char const* in, std::size_t bytes)
{ {
auto const p (reinterpret_cast <joyent::http_parser const*> (&state_));
bool const is_final (
joyent::http_body_is_final (p) != 0);
return ec_ ? 1 : 0; return ec_ ? 1 : 0;
} }
int int
message_parser::do_message_complete () message_parser::do_message_complete ()
{ {
auto const p (reinterpret_cast <joyent::http_parser const*> (&state_));
bool const keep_alive (joyent::http_should_keep_alive (p) != 0);
complete_ = true; complete_ = true;
return 0; return 0;
} }

View File

@@ -1055,6 +1055,8 @@ void LedgerEntrySet::ownerCountAdjust (
TER LedgerEntrySet::offerDelete (SLE::pointer sleOffer) TER LedgerEntrySet::offerDelete (SLE::pointer sleOffer)
{ {
if (!sleOffer)
return tesSUCCESS;
auto offerIndex = sleOffer->getIndex (); auto offerIndex = sleOffer->getIndex ();
auto owner = sleOffer->getFieldAccount160 (sfAccount); auto owner = sleOffer->getFieldAccount160 (sfAccount);
@@ -1079,16 +1081,6 @@ TER LedgerEntrySet::offerDelete (SLE::pointer sleOffer)
return (terResult == tesSUCCESS) ? terResult2 : terResult; return (terResult == tesSUCCESS) ? terResult2 : terResult;
} }
TER LedgerEntrySet::offerDelete (uint256 const& offerIndex)
{
SLE::pointer sleOffer = entryCache (ltOFFER, offerIndex);
if (!sleOffer)
return tesSUCCESS;
return offerDelete (sleOffer);
}
// Returns amount owed by uToAccountID to uFromAccountID. // Returns amount owed by uToAccountID to uFromAccountID.
// <-- $owed/currency/uToAccountID: // <-- $owed/currency/uToAccountID:
// positive: uFromAccountID holds IOUs., // positive: uFromAccountID holds IOUs.,

View File

@@ -187,8 +187,11 @@ public:
SLE::ref sleAccountRoot = SLE::pointer ()); SLE::ref sleAccountRoot = SLE::pointer ());
// Offer functions. // Offer functions.
TER offerDelete (uint256 const & offerIndex); TER offerDelete (SLE::pointer);
TER offerDelete (SLE::pointer sleOffer); TER offerDelete (uint256 const& offerIndex)
{
return offerDelete( entryCache (ltOFFER, offerIndex));
}
// Balance functions. // Balance functions.
std::uint32_t rippleTransferRate (Account const& issuer); std::uint32_t rippleTransferRate (Account const& issuer);

View File

@@ -36,7 +36,7 @@ bool transResultInfo (TER terCode, std::string& strToken, std::string& strHuman)
{ tecNO_DST, "tecNO_DST", "Destination does not exist. Send XRP to create it." }, { tecNO_DST, "tecNO_DST", "Destination does not exist. Send XRP to create it." },
{ tecNO_DST_INSUF_XRP, "tecNO_DST_INSUF_XRP", "Destination does not exist. Too little XRP sent to create it." }, { tecNO_DST_INSUF_XRP, "tecNO_DST_INSUF_XRP", "Destination does not exist. Too little XRP sent to create it." },
{ tecNO_LINE_INSUF_RESERVE, "tecNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." }, { tecNO_LINE_INSUF_RESERVE, "tecNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." },
{ tecNO_LINE_REDUNDANT, "tecNO_LINE_REDUNDANT", "Can't set non-existant line to default." }, { tecNO_LINE_REDUNDANT, "tecNO_LINE_REDUNDANT", "Can't set non-existent line to default." },
{ tecPATH_DRY, "tecPATH_DRY", "Path could not send partial amount." }, { tecPATH_DRY, "tecPATH_DRY", "Path could not send partial amount." },
{ tecPATH_PARTIAL, "tecPATH_PARTIAL", "Path could not send full amount." }, { tecPATH_PARTIAL, "tecPATH_PARTIAL", "Path could not send full amount." },
{ tecMASTER_DISABLED, "tecMASTER_DISABLED", "Master key is disabled." }, { tecMASTER_DISABLED, "tecMASTER_DISABLED", "Master key is disabled." },
@@ -51,24 +51,20 @@ bool transResultInfo (TER terCode, std::string& strToken, std::string& strHuman)
{ tecNO_AUTH, "tecNO_AUTH", "Not authorized to hold asset." }, { tecNO_AUTH, "tecNO_AUTH", "Not authorized to hold asset." },
{ tecNO_LINE, "tecNO_LINE", "No such line." }, { tecNO_LINE, "tecNO_LINE", "No such line." },
{ tefFAILURE, "tefFAILURE", "Failed to apply." },
{ tefALREADY, "tefALREADY", "The exact transaction was already in this ledger." }, { tefALREADY, "tefALREADY", "The exact transaction was already in this ledger." },
{ tefBAD_ADD_AUTH, "tefBAD_ADD_AUTH", "Not authorized to add account." }, { tefBAD_ADD_AUTH, "tefBAD_ADD_AUTH", "Not authorized to add account." },
{ tefBAD_AUTH, "tefBAD_AUTH", "Transaction's public key is not authorized." }, { tefBAD_AUTH, "tefBAD_AUTH", "Transaction's public key is not authorized." },
{ tefBAD_CLAIM_ID, "tefBAD_CLAIM_ID", "Malformed: Bad claim id." },
{ tefBAD_GEN_AUTH, "tefBAD_GEN_AUTH", "Not authorized to claim generator." },
{ tefBAD_LEDGER, "tefBAD_LEDGER", "Ledger in unexpected state." }, { tefBAD_LEDGER, "tefBAD_LEDGER", "Ledger in unexpected state." },
{ tefCLAIMED, "tefCLAIMED", "Can not claim a previously claimed account." },
{ tefCREATED, "tefCREATED", "Can't add an already created account." }, { tefCREATED, "tefCREATED", "Can't add an already created account." },
{ tefDST_TAG_NEEDED, "tefDST_TAG_NEEDED", "Destination tag required." }, { tefDST_TAG_NEEDED, "tefDST_TAG_NEEDED", "Destination tag required." },
{ tefEXCEPTION, "tefEXCEPTION", "Unexpected program state." }, { tefEXCEPTION, "tefEXCEPTION", "Unexpected program state." },
{ tefGEN_IN_USE, "tefGEN_IN_USE", "Generator already in use." }, { tefFAILURE, "tefFAILURE", "Failed to apply." },
{ tefINTERNAL, "tefINTERNAL", "Internal error." }, { tefINTERNAL, "tefINTERNAL", "Internal error." },
{ tefMASTER_DISABLED, "tefMASTER_DISABLED", "Master key is disabled." },
{ tefMAX_LEDGER, "tefMAX_LEDGER", "Ledger sequence too high." },
{ tefNO_AUTH_REQUIRED, "tefNO_AUTH_REQUIRED", "Auth is not required." }, { tefNO_AUTH_REQUIRED, "tefNO_AUTH_REQUIRED", "Auth is not required." },
{ tefPAST_SEQ, "tefPAST_SEQ", "This sequence number has already past." }, { tefPAST_SEQ, "tefPAST_SEQ", "This sequence number has already past." },
{ tefWRONG_PRIOR, "tefWRONG_PRIOR", "This previous transaction does not match." }, { tefWRONG_PRIOR, "tefWRONG_PRIOR", "This previous transaction does not match." },
{ tefMASTER_DISABLED, "tefMASTER_DISABLED", "Master key is disabled." },
{ tefMAX_LEDGER, "tefMAX_LEDGER", "Ledger sequence too high." },
{ telLOCAL_ERROR, "telLOCAL_ERROR", "Local failure." }, { telLOCAL_ERROR, "telLOCAL_ERROR", "Local failure." },
{ telBAD_DOMAIN, "telBAD_DOMAIN", "Domain too long." }, { telBAD_DOMAIN, "telBAD_DOMAIN", "Domain too long." },
@@ -82,23 +78,22 @@ bool transResultInfo (TER terCode, std::string& strToken, std::string& strHuman)
{ temBAD_AMOUNT, "temBAD_AMOUNT", "Can only send positive amounts." }, { temBAD_AMOUNT, "temBAD_AMOUNT", "Can only send positive amounts." },
{ temBAD_AUTH_MASTER, "temBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." }, { temBAD_AUTH_MASTER, "temBAD_AUTH_MASTER", "Auth for unclaimed account needs correct master key." },
{ temBAD_CURRENCY, "temBAD_CURRENCY", "Malformed: Bad currency." }, { temBAD_CURRENCY, "temBAD_CURRENCY", "Malformed: Bad currency." },
{ temBAD_FEE, "temBAD_FEE", "Invalid fee, negative or not XRP." },
{ temBAD_EXPIRATION, "temBAD_EXPIRATION", "Malformed: Bad expiration." }, { temBAD_EXPIRATION, "temBAD_EXPIRATION", "Malformed: Bad expiration." },
{ temBAD_FEE, "temBAD_FEE", "Invalid fee, negative or not XRP." },
{ temBAD_ISSUER, "temBAD_ISSUER", "Malformed: Bad issuer." }, { temBAD_ISSUER, "temBAD_ISSUER", "Malformed: Bad issuer." },
{ temBAD_LIMIT, "temBAD_LIMIT", "Limits must be non-negative." }, { temBAD_LIMIT, "temBAD_LIMIT", "Limits must be non-negative." },
{ temBAD_OFFER, "temBAD_OFFER", "Malformed: Bad offer." }, { temBAD_OFFER, "temBAD_OFFER", "Malformed: Bad offer." },
{ temBAD_PATH, "temBAD_PATH", "Malformed: Bad path." }, { temBAD_PATH, "temBAD_PATH", "Malformed: Bad path." },
{ temBAD_PATH_LOOP, "temBAD_PATH_LOOP", "Malformed: Loop in path." }, { temBAD_PATH_LOOP, "temBAD_PATH_LOOP", "Malformed: Loop in path." },
{ temBAD_PUBLISH, "temBAD_PUBLISH", "Malformed: Bad publish." },
{ temBAD_SIGNATURE, "temBAD_SIGNATURE", "Malformed: Bad signature." },
{ temBAD_SRC_ACCOUNT, "temBAD_SRC_ACCOUNT", "Malformed: Bad source account." },
{ temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" },
{ temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." },
{ temBAD_SEND_XRP_LIMIT, "temBAD_SEND_XRP_LIMIT", "Malformed: Limit quality is not allowed for XRP to XRP." }, { temBAD_SEND_XRP_LIMIT, "temBAD_SEND_XRP_LIMIT", "Malformed: Limit quality is not allowed for XRP to XRP." },
{ temBAD_SEND_XRP_MAX, "temBAD_SEND_XRP_MAX", "Malformed: Send max is not allowed for XRP to XRP." }, { temBAD_SEND_XRP_MAX, "temBAD_SEND_XRP_MAX", "Malformed: Send max is not allowed for XRP to XRP." },
{ temBAD_SEND_XRP_NO_DIRECT, "temBAD_SEND_XRP_NO_DIRECT", "Malformed: No Ripple direct is not allowed for XRP to XRP." }, { temBAD_SEND_XRP_NO_DIRECT, "temBAD_SEND_XRP_NO_DIRECT", "Malformed: No Ripple direct is not allowed for XRP to XRP." },
{ temBAD_SEND_XRP_PARTIAL, "temBAD_SEND_XRP_PARTIAL", "Malformed: Partial payment is not allowed for XRP to XRP." }, { temBAD_SEND_XRP_PARTIAL, "temBAD_SEND_XRP_PARTIAL", "Malformed: Partial payment is not allowed for XRP to XRP." },
{ temBAD_SEND_XRP_PATHS, "temBAD_SEND_XRP_PATHS", "Malformed: Paths are not allowed for XRP to XRP." }, { temBAD_SEND_XRP_PATHS, "temBAD_SEND_XRP_PATHS", "Malformed: Paths are not allowed for XRP to XRP." },
{ temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." },
{ temBAD_SIGNATURE, "temBAD_SIGNATURE", "Malformed: Bad signature." },
{ temBAD_SRC_ACCOUNT, "temBAD_SRC_ACCOUNT", "Malformed: Bad source account." },
{ temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" },
{ temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." }, { temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." },
{ temDST_NEEDED, "temDST_NEEDED", "Destination not specified." }, { temDST_NEEDED, "temDST_NEEDED", "Destination not specified." },
{ temINVALID, "temINVALID", "The transaction is ill-formed." }, { temINVALID, "temINVALID", "The transaction is ill-formed." },

View File

@@ -24,10 +24,6 @@ namespace ripple {
// See https://ripple.com/wiki/Transaction_errors // See https://ripple.com/wiki/Transaction_errors
// VFALCO TODO do not use auto-incrementing. Explicitly assign each
// constant so there is no possibility of someone coming in
// and screwing it up.
//
// VFALCO TODO consider renaming TER to TxErr or TxResult for clarity. // VFALCO TODO consider renaming TER to TxErr or TxResult for clarity.
// //
enum TER // aka TransactionEngineResult enum TER // aka TransactionEngineResult
@@ -40,7 +36,7 @@ enum TER // aka TransactionEngineResult
// - Not forwarded // - Not forwarded
// - No fee check // - No fee check
telLOCAL_ERROR = -399, telLOCAL_ERROR = -399,
telBAD_DOMAIN, // VFALCO TODO should read "telBAD_DOMAIN = -398," etc... telBAD_DOMAIN,
telBAD_PATH_COUNT, telBAD_PATH_COUNT,
telBAD_PUBLIC_KEY, telBAD_PUBLIC_KEY,
telFAILED_PROCESSING, telFAILED_PROCESSING,
@@ -56,26 +52,26 @@ enum TER // aka TransactionEngineResult
// - Reject // - Reject
// - Can not succeed in any imagined ledger. // - Can not succeed in any imagined ledger.
temMALFORMED = -299, temMALFORMED = -299,
temBAD_AMOUNT, temBAD_AMOUNT,
temBAD_AUTH_MASTER, temBAD_AUTH_MASTER,
temBAD_CURRENCY, temBAD_CURRENCY,
temBAD_FEE,
temBAD_EXPIRATION, temBAD_EXPIRATION,
temBAD_FEE,
temBAD_ISSUER, temBAD_ISSUER,
temBAD_LIMIT, temBAD_LIMIT,
temBAD_OFFER, temBAD_OFFER,
temBAD_PATH, temBAD_PATH,
temBAD_PATH_LOOP, temBAD_PATH_LOOP,
temBAD_PUBLISH,
temBAD_TRANSFER_RATE,
temBAD_SEND_XRP_LIMIT, temBAD_SEND_XRP_LIMIT,
temBAD_SEND_XRP_MAX, temBAD_SEND_XRP_MAX,
temBAD_SEND_XRP_NO_DIRECT, temBAD_SEND_XRP_NO_DIRECT,
temBAD_SEND_XRP_PARTIAL, temBAD_SEND_XRP_PARTIAL,
temBAD_SEND_XRP_PATHS, temBAD_SEND_XRP_PATHS,
temBAD_SEQUENCE,
temBAD_SIGNATURE, temBAD_SIGNATURE,
temBAD_SRC_ACCOUNT, temBAD_SRC_ACCOUNT,
temBAD_SEQUENCE, temBAD_TRANSFER_RATE,
temDST_IS_SRC, temDST_IS_SRC,
temDST_NEEDED, temDST_NEEDED,
temINVALID, temINVALID,
@@ -83,14 +79,19 @@ enum TER // aka TransactionEngineResult
temREDUNDANT, temREDUNDANT,
temREDUNDANT_SEND_MAX, temREDUNDANT_SEND_MAX,
temRIPPLE_EMPTY, temRIPPLE_EMPTY,
temUNCERTAIN, // An intermediate result used internally, should never be returned.
// An intermediate result used internally, should never be returned.
temUNCERTAIN,
temUNKNOWN, temUNKNOWN,
// -199 .. -100: F Failure (sequence number previously used) // -199 .. -100: F
// Failure (sequence number previously used)
//
// Causes: // Causes:
// - Transaction cannot succeed because of ledger state. // - Transaction cannot succeed because of ledger state.
// - Unexpected ledger state. // - Unexpected ledger state.
// - C++ exception. // - C++ exception.
//
// Implications: // Implications:
// - Not applied // - Not applied
// - Not forwarded // - Not forwarded
@@ -99,14 +100,10 @@ enum TER // aka TransactionEngineResult
tefALREADY, tefALREADY,
tefBAD_ADD_AUTH, tefBAD_ADD_AUTH,
tefBAD_AUTH, tefBAD_AUTH,
tefBAD_CLAIM_ID,
tefBAD_GEN_AUTH,
tefBAD_LEDGER, tefBAD_LEDGER,
tefCLAIMED,
tefCREATED, tefCREATED,
tefDST_TAG_NEEDED, tefDST_TAG_NEEDED,
tefEXCEPTION, tefEXCEPTION,
tefGEN_IN_USE,
tefINTERNAL, tefINTERNAL,
tefNO_AUTH_REQUIRED, // Can't set auth if auth is not required. tefNO_AUTH_REQUIRED, // Can't set auth if auth is not required.
tefPAST_SEQ, tefPAST_SEQ,
@@ -114,9 +111,14 @@ enum TER // aka TransactionEngineResult
tefMASTER_DISABLED, tefMASTER_DISABLED,
tefMAX_LEDGER, tefMAX_LEDGER,
// -99 .. -1: R Retry (sequence too high, no funds for txn fee, originating account non-existent) // -99 .. -1: R Retry
// Causes: // sequence too high, no funds for txn fee, originating -account
// - Prior application of another, possibly non-existant, another transaction could allow this transaction to succeed. // non-existent
//
// Cause:
// Prior application of another, possibly non-existent, transaction could
// allow this transaction to succeed.
//
// Implications: // Implications:
// - Not applied // - Not applied
// - Not forwarded // - Not forwarded
@@ -124,13 +126,14 @@ enum TER // aka TransactionEngineResult
// - Hold // - Hold
// - Makes hole in sequence which jams transactions. // - Makes hole in sequence which jams transactions.
terRETRY = -99, terRETRY = -99,
terFUNDS_SPENT, // This is a free transaction, therefore don't burden network. terFUNDS_SPENT, // This is a free transaction, so don't burden network.
terINSUF_FEE_B, // Can't pay fee, therefore don't burden network. terINSUF_FEE_B, // Can't pay fee, therefore don't burden network.
terNO_ACCOUNT, // Can't pay fee, therefore don't burden network. terNO_ACCOUNT, // Can't pay fee, therefore don't burden network.
terNO_AUTH, // Not authorized to hold IOUs. terNO_AUTH, // Not authorized to hold IOUs.
terNO_LINE, // Internal flag. terNO_LINE, // Internal flag.
terOWNERS, // Can't succeed with non-zero owner count. terOWNERS, // Can't succeed with non-zero owner count.
terPRE_SEQ, // Can't pay fee, no point in forwarding, therefore don't burden network. terPRE_SEQ, // Can't pay fee, no point in forwarding, so don't
// burden network.
terLAST, // Process after all other transactions terLAST, // Process after all other transactions
terNO_RIPPLE, // Rippling not allowed terNO_RIPPLE, // Rippling not allowed
@@ -142,14 +145,21 @@ enum TER // aka TransactionEngineResult
// - Forwarded // - Forwarded
tesSUCCESS = 0, tesSUCCESS = 0,
// 100 .. 159 C Claim fee only (ripple transaction with no good paths, pay to non-existent account, no path) // 100 .. 159 C
// Claim fee only (ripple transaction with no good paths, pay to
// non-existent account, no path)
//
// Causes: // Causes:
// - Success, but does not achieve optimal result. // - Success, but does not achieve optimal result.
// - Invalid transaction or no effect, but claim fee to use the sequence number. // - Invalid transaction or no effect, but claim fee to use the sequence
// number.
//
// Implications: // Implications:
// - Applied // - Applied
// - Forwarded // - Forwarded
// Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY. //
// Only allowed as a return code of appliedTransaction when !tapRetry.
// Otherwise, treated as terRETRY.
// //
// DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data. // DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data.
tecCLAIM = 100, tecCLAIM = 100,
@@ -175,13 +185,35 @@ enum TER // aka TransactionEngineResult
tecNO_LINE = 135, tecNO_LINE = 135,
}; };
// VFALCO TODO change these to normal functions. inline bool isTelLocal(TER x)
#define isTelLocal(x) ((x) >= telLOCAL_ERROR && (x) < temMALFORMED) {
#define isTemMalformed(x) ((x) >= temMALFORMED && (x) < tefFAILURE) return ((x) >= telLOCAL_ERROR && (x) < temMALFORMED);
#define isTefFailure(x) ((x) >= tefFAILURE && (x) < terRETRY) }
#define isTerRetry(x) ((x) >= terRETRY && (x) < tesSUCCESS)
#define isTesSuccess(x) ((x) == tesSUCCESS) inline bool isTemMalformed(TER x)
#define isTecClaim(x) ((x) >= tecCLAIM) {
return ((x) >= temMALFORMED && (x) < tefFAILURE);
}
inline bool isTefFailure(TER x)
{
return ((x) >= tefFAILURE && (x) < terRETRY);
}
inline bool isTerRetry(TER x)
{
return ((x) >= terRETRY && (x) < tesSUCCESS);
}
inline bool isTesSuccess(TER x)
{
return ((x) == tesSUCCESS);
}
inline bool isTecClaim(TER x)
{
return ((x) >= tecCLAIM);
}
// VFALCO TODO group these into a shell class along with the defines above. // VFALCO TODO group these into a shell class along with the defines above.
extern bool transResultInfo (TER terCode, std::string& strToken, std::string& strHuman); extern bool transResultInfo (TER terCode, std::string& strToken, std::string& strHuman);