rippled
apply.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_TX_APPLY_H_INCLUDED
21 #define RIPPLE_TX_APPLY_H_INCLUDED
22 
23 #include <ripple/core/Config.h>
24 #include <ripple/ledger/View.h>
25 #include <ripple/protocol/STTx.h>
26 #include <ripple/protocol/TER.h>
27 #include <ripple/beast/utility/Journal.h>
28 #include <memory>
29 #include <utility>
30 
31 namespace ripple {
32 
33 class Application;
34 class HashRouter;
35 
40 enum class Validity
41 {
43  SigBad,
47  Valid
48 };
49 
64 checkValidity(HashRouter& router,
65  STTx const& tx, Rules const& rules,
66  Config const& config);
67 
68 
78 void
79 forceValidity(HashRouter& router, uint256 const& txid,
80  Validity validity);
81 
124 apply (Application& app, OpenView& view,
125  STTx const& tx, ApplyFlags flags,
126  beast::Journal journal);
127 
128 
133 enum class ApplyResult
134 {
136  Success,
138  Fail,
140  Retry
141 };
142 
151 applyTransaction(Application& app, OpenView& view,
152  STTx const& tx, bool retryAssured, ApplyFlags flags,
153  beast::Journal journal);
154 
155 } // ripple
156 
157 #endif
utility
ripple::apply
std::pair< TER, bool > apply(Application &app, OpenView &view, STTx const &tx, ApplyFlags flags, beast::Journal journal)
Apply a transaction to an OpenView.
Definition: apply.cpp:108
std::pair
ripple::applyTransaction
ApplyResult applyTransaction(Application &app, OpenView &view, STTx const &tx, bool retryAssured, ApplyFlags flags, beast::Journal journal)
Transaction application helper.
Definition: apply.cpp:118
ripple::ApplyFlags
ApplyFlags
Definition: ApplyView.h:30
ripple::Validity
Validity
Describes the pre-processing validity of a transaction.
Definition: apply.h:40
ripple::ApplyResult
ApplyResult
Enum class for return value from applyTransaction
Definition: apply.h:133
ripple::forceValidity
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
Definition: apply.cpp:87
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:436
ripple::Validity::SigGoodOnly
@ SigGoodOnly
Signature is good, but local checks fail.
ripple::checkValidity
std::pair< Validity, std::string > checkValidity(HashRouter &router, STTx const &tx, Rules const &rules, Config const &config)
Checks transaction signature and local checks.
Definition: apply.cpp:37
ripple::ApplyResult::Retry
@ Retry
Should be retried in this ledger.
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:60
ripple::ApplyResult::Success
@ Success
Applied to this ledger.
memory
ripple::ApplyResult::Fail
@ Fail
Should not be retried in this ledger.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Validity::Valid
@ Valid
Signature and local checks are good / passed.
ripple::Validity::SigBad
@ SigBad
Signature is bad. Didn't do local checks.