rippled
Loading...
Searching...
No Matches
Wallet.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2021 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_APP_RDB_WALLET_H_INCLUDED
21#define RIPPLE_APP_RDB_WALLET_H_INCLUDED
22
23#include <xrpld/app/ledger/Ledger.h>
24#include <xrpld/app/misc/Manifest.h>
25#include <xrpld/core/Config.h>
26#include <xrpld/core/DatabaseCon.h>
27#include <xrpld/overlay/PeerReservationTable.h>
28#include <xrpld/peerfinder/detail/Store.h>
29
30namespace ripple {
31
39makeWalletDB(DatabaseCon::Setup const& setup, beast::Journal j);
40
50 DatabaseCon::Setup const& setup,
51 std::string const& dbname,
53
63void
65 soci::session& session,
66 std::string const& dbTable,
67 ManifestCache& mCache,
69
78void
80 soci::session& session,
81 std::string const& dbTable,
82 std::function<bool(PublicKey const&)> const& isTrusted,
83 hash_map<PublicKey, Manifest> const& map,
85
92void
93addValidatorManifest(soci::session& session, std::string const& serialized);
94
96void
97clearNodeIdentity(soci::session& session);
98
110getNodeIdentity(soci::session& session);
111
119getPeerReservationTable(soci::session& session, beast::Journal j);
120
127void
129 soci::session& session,
130 PublicKey const& nodeId,
131 std::string const& description);
132
139void
140deletePeerReservation(soci::session& session, PublicKey const& nodeId);
141
147bool
148createFeatureVotes(soci::session& session);
149
150// For historical reasons the up-vote and down-vote integer representations
151// are unintuitive.
152enum class AmendmentVote : int { obsolete = -1, up = 0, down = 1 };
153
160void
162 soci::session& session,
163 std::function<void(
164 boost::optional<std::string> amendment_hash,
165 boost::optional<std::string> amendment_name,
166 boost::optional<AmendmentVote> vote)> const& callback);
167
175void
177 soci::session& session,
178 uint256 const& amendment,
179 std::string const& name,
180 AmendmentVote vote);
181
182} // namespace ripple
183
184#endif
A generic endpoint for log messages.
Definition: Journal.h:59
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
AmendmentVote
Definition: Wallet.h:152
void saveManifests(soci::session &session, std::string const &dbTable, std::function< bool(PublicKey const &)> const &isTrusted, hash_map< PublicKey, Manifest > const &map, beast::Journal j)
saveManifests Saves all given manifests to the database.
Definition: Wallet.cpp:93
base_uint< 256 > uint256
Definition: base_uint.h:557
std::unordered_set< PeerReservation, beast::uhash<>, KeyEqual > getPeerReservationTable(soci::session &session, beast::Journal j)
getPeerReservationTable Returns the peer reservation table.
Definition: Wallet.cpp:169
void insertPeerReservation(soci::session &session, PublicKey const &nodeId, std::string const &description)
insertPeerReservation Adds an entry to the peer reservation table.
Definition: Wallet.cpp:206
void addValidatorManifest(soci::session &session, std::string const &serialized)
addValidatorManifest Saves the manifest of a validator to the database.
Definition: Wallet.cpp:118
std::pair< PublicKey, SecretKey > getNodeIdentity(Application &app, boost::program_options::variables_map const &cmdline)
The cryptographic credentials identifying this server instance.
bool createFeatureVotes(soci::session &session)
createFeatureVotes Creates the FeatureVote table if it does not exist.
Definition: Wallet.cpp:228
std::unique_ptr< DatabaseCon > makeTestWalletDB(DatabaseCon::Setup const &setup, std::string const &dbname, beast::Journal j)
makeTestWalletDB Opens a test wallet database with an arbitrary name.
Definition: Wallet.cpp:34
void readAmendments(soci::session &session, std::function< void(boost::optional< std::string > amendment_hash, boost::optional< std::string > amendment_name, boost::optional< AmendmentVote > vote)> const &callback)
readAmendments Reads all amendments from the FeatureVotes table.
Definition: Wallet.cpp:252
void clearNodeIdentity(soci::session &session)
Delete any saved public/private key associated with this node.
Definition: Wallet.cpp:126
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup, beast::Journal j)
makeWalletDB Opens the wallet database and returns it.
Definition: Wallet.cpp:26
void getManifests(soci::session &session, std::string const &dbTable, ManifestCache &mCache, beast::Journal j)
getManifests Loads a manifest from the wallet database and stores it in the cache.
Definition: Wallet.cpp:45
void deletePeerReservation(soci::session &session, PublicKey const &nodeId)
deletePeerReservation Deletes an entry from the peer reservation table.
Definition: Wallet.cpp:220
void voteAmendment(soci::session &session, uint256 const &amendment, std::string const &name, AmendmentVote vote)
voteAmendment Set the veto value for a particular amendment.
Definition: Wallet.cpp:288