xrpld
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
15std::unique_ptr<DatabaseCon>
16makeWalletDB(DatabaseCon::Setup const& setup, beast::Journal j);
17
25std::unique_ptr<DatabaseCon>
26makeTestWalletDB(DatabaseCon::Setup const& setup, std::string const& dbname, beast::Journal j);
27
37void
39 soci::session& session,
40 std::string const& dbTable,
41 ManifestCache& cache,
42 beast::Journal j);
43
52void
54 soci::session& session,
55 std::string const& dbTable,
56 std::function<bool(PublicKey const&)> const& isTrusted,
58 beast::Journal j);
59
66void
67addValidatorManifest(soci::session& session, std::string const& serialized);
68
70void
71clearNodeIdentity(soci::session& session);
72
83std::pair<PublicKey, SecretKey>
84getNodeIdentity(soci::session& session);
85
92std::unordered_set<PeerReservation, beast::Uhash<>, KeyEqual>
93getPeerReservationTable(soci::session& session, beast::Journal j);
94
101void
103 soci::session& session,
104 PublicKey const& nodeId,
105 std::string const& description);
106
113void
114deletePeerReservation(soci::session& session, PublicKey const& nodeId);
115
121bool
122createFeatureVotes(soci::session& session);
123
124// For historical reasons the up-vote and down-vote integer representations
125// are unintuitive.
126enum class AmendmentVote : int { Obsolete = -1, Up = 0, Down = 1 };
127
134void
136 soci::session& session,
137 std::function<void(
138 boost::optional<std::string> amendmentHash,
139 boost::optional<std::string> amendmentName,
140 boost::optional<AmendmentVote> vote)> const& callback);
141
149void
151 soci::session& session,
152 uint256 const& amendment,
153 std::string const& name,
154 AmendmentVote vote);
155
156} // namespace xrpl
Remembers manifests with the highest sequence number.
Definition Manifest.h:236
A public key.
Definition PublicKey.h:42
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
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:99
void deletePeerReservation(soci::session &session, PublicKey const &nodeId)
deletePeerReservation Deletes an entry from the peer reservation table.
Definition Wallet.cpp:222
std::pair< PublicKey, SecretKey > getNodeIdentity(soci::session &session)
Returns a stable public and private key for this node.
Definition Wallet.cpp:138
void insertPeerReservation(soci::session &session, PublicKey const &nodeId, std::string const &description)
insertPeerReservation Adds an entry to the peer reservation table.
Definition Wallet.cpp:208
void readAmendments(soci::session &session, std::function< void(boost::optional< std::string > amendmentHash, boost::optional< std::string > amendmentName, boost::optional< AmendmentVote > vote)> const &callback)
readAmendments Reads all amendments from the FeatureVotes table.
Definition Wallet.cpp:253
std::unordered_set< PeerReservation, beast::Uhash<>, KeyEqual > getPeerReservationTable(soci::session &session, beast::Journal j)
getPeerReservationTable Returns the peer reservation table.
Definition Wallet.cpp:173
void addValidatorManifest(soci::session &session, std::string const &serialized)
addValidatorManifest Saves the manifest of a validator to the database.
Definition Wallet.cpp:124
std::unique_ptr< DatabaseCon > makeWalletDB(DatabaseCon::Setup const &setup, beast::Journal j)
makeWalletDB Opens the wallet database and returns it.
Definition Wallet.cpp:39
bool createFeatureVotes(soci::session &session)
createFeatureVotes Creates the FeatureVote table if it does not exist.
Definition Wallet.cpp:229
AmendmentVote
Definition Wallet.h:126
std::unordered_map< Key, Value, Hash, Pred, Allocator > hash_map
void clearNodeIdentity(soci::session &session)
Delete any saved public/private key associated with this node.
Definition Wallet.cpp:132
void getManifests(soci::session &session, std::string const &dbTable, ManifestCache &cache, beast::Journal j)
getManifests Loads a manifest from the wallet database and stores it in the cache.
Definition Wallet.cpp:55
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:47
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
BaseUInt< 256 > uint256
Definition base_uint.h:562