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/misc/Manifest.h>
24#include <xrpld/core/Config.h>
25#include <xrpld/core/DatabaseCon.h>
26#include <xrpld/overlay/PeerReservationTable.h>
27
28namespace ripple {
29
37makeWalletDB(DatabaseCon::Setup const& setup, beast::Journal j);
38
48 DatabaseCon::Setup const& setup,
49 std::string const& dbname,
51
61void
63 soci::session& session,
64 std::string const& dbTable,
65 ManifestCache& mCache,
67
76void
78 soci::session& session,
79 std::string const& dbTable,
80 std::function<bool(PublicKey const&)> const& isTrusted,
81 hash_map<PublicKey, Manifest> const& map,
83
90void
91addValidatorManifest(soci::session& session, std::string const& serialized);
92
94void
95clearNodeIdentity(soci::session& session);
96
108getNodeIdentity(soci::session& session);
109
117getPeerReservationTable(soci::session& session, beast::Journal j);
118
125void
127 soci::session& session,
128 PublicKey const& nodeId,
129 std::string const& description);
130
137void
138deletePeerReservation(soci::session& session, PublicKey const& nodeId);
139
145bool
146createFeatureVotes(soci::session& session);
147
148// For historical reasons the up-vote and down-vote integer representations
149// are unintuitive.
150enum class AmendmentVote : int { obsolete = -1, up = 0, down = 1 };
151
158void
160 soci::session& session,
161 std::function<void(
162 boost::optional<std::string> amendment_hash,
163 boost::optional<std::string> amendment_name,
164 boost::optional<AmendmentVote> vote)> const& callback);
165
173void
175 soci::session& session,
176 uint256 const& amendment,
177 std::string const& name,
178 AmendmentVote vote);
179
180} // namespace ripple
181
182#endif
A generic endpoint for log messages.
Definition Journal.h:60
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
AmendmentVote
Definition Wallet.h:150
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:94
base_uint< 256 > uint256
Definition base_uint.h:558
std::unordered_set< PeerReservation, beast::uhash<>, KeyEqual > getPeerReservationTable(soci::session &session, beast::Journal j)
getPeerReservationTable Returns the peer reservation table.
Definition Wallet.cpp:170
void insertPeerReservation(soci::session &session, PublicKey const &nodeId, std::string const &description)
insertPeerReservation Adds an entry to the peer reservation table.
Definition Wallet.cpp:207
void addValidatorManifest(soci::session &session, std::string const &serialized)
addValidatorManifest Saves the manifest of a validator to the database.
Definition Wallet.cpp:119
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:229
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:35
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:253
void clearNodeIdentity(soci::session &session)
Delete any saved public/private key associated with this node.
Definition Wallet.cpp:127
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup, beast::Journal j)
makeWalletDB Opens the wallet database and returns it.
Definition Wallet.cpp:27
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:46
void deletePeerReservation(soci::session &session, PublicKey const &nodeId)
deletePeerReservation Deletes an entry from the peer reservation table.
Definition Wallet.cpp:221
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:289