rippled
Loading...
Searching...
No Matches
Wallet.h
1#pragma once
2
3#include <xrpl/core/PeerReservationTable.h>
4#include <xrpl/rdb/DatabaseCon.h>
5#include <xrpl/server/Manifest.h>
6
7namespace xrpl {
8
16makeWalletDB(DatabaseCon::Setup const& setup, beast::Journal j);
17
26makeTestWalletDB(DatabaseCon::Setup const& setup, std::string const& dbname, beast::Journal j);
27
37void
38getManifests(soci::session& session, std::string const& dbTable, ManifestCache& mCache, beast::Journal j);
39
48void
50 soci::session& session,
51 std::string const& dbTable,
52 std::function<bool(PublicKey const&)> const& isTrusted,
53 hash_map<PublicKey, Manifest> const& map,
55
62void
63addValidatorManifest(soci::session& session, std::string const& serialized);
64
66void
67clearNodeIdentity(soci::session& session);
68
80getNodeIdentity(soci::session& session);
81
89getPeerReservationTable(soci::session& session, beast::Journal j);
90
97void
98insertPeerReservation(soci::session& session, PublicKey const& nodeId, std::string const& description);
99
106void
107deletePeerReservation(soci::session& session, PublicKey const& nodeId);
108
114bool
115createFeatureVotes(soci::session& session);
116
117// For historical reasons the up-vote and down-vote integer representations
118// are unintuitive.
119enum class AmendmentVote : int { obsolete = -1, up = 0, down = 1 };
120
127void
129 soci::session& session,
130 std::function<void(
131 boost::optional<std::string> amendment_hash,
132 boost::optional<std::string> amendment_name,
133 boost::optional<AmendmentVote> vote)> const& callback);
134
142void
143voteAmendment(soci::session& session, uint256 const& amendment, std::string const& name, AmendmentVote vote);
144
145} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
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:23
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:63
void deletePeerReservation(soci::session &session, PublicKey const &nodeId)
deletePeerReservation Deletes an entry from the peer reservation table.
Definition Wallet.cpp:181
std::pair< PublicKey, SecretKey > getNodeIdentity(soci::session &session)
Returns a stable public and private key for this node.
Definition Wallet.cpp:102
void insertPeerReservation(soci::session &session, PublicKey const &nodeId, std::string const &description)
insertPeerReservation Adds an entry to the peer reservation table.
Definition Wallet.cpp:170
std::unordered_set< PeerReservation, beast::uhash<>, KeyEqual > getPeerReservationTable(soci::session &session, beast::Journal j)
getPeerReservationTable Returns the peer reservation table.
Definition Wallet.cpp:135
void addValidatorManifest(soci::session &session, std::string const &serialized)
addValidatorManifest Saves the manifest of a validator to the database.
Definition Wallet.cpp:88
base_uint< 256 > uint256
Definition base_uint.h:526
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:212
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup, beast::Journal j)
makeWalletDB Opens the wallet database and returns it.
Definition Wallet.cpp:9
bool createFeatureVotes(soci::session &session)
createFeatureVotes Creates the FeatureVote table if it does not exist.
Definition Wallet.cpp:188
AmendmentVote
Definition Wallet.h:119
void clearNodeIdentity(soci::session &session)
Delete any saved public/private key associated with this node.
Definition Wallet.cpp:96
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:16
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:244