mirror of https://github.com/oxen-io/oxen-core.git
parent
ac26747529
commit
bbdd91a3bb
|
@ -141,7 +141,7 @@ namespace cryptonote {
|
|||
update_height(height - 1);
|
||||
}
|
||||
|
||||
bool BlockchainSQLite::add_sn_payments(std::vector<cryptonote::batch_sn_payment>& payments) {
|
||||
bool BlockchainSQLite::add_sn_rewards(const std::vector<cryptonote::batch_sn_payment>& payments) {
|
||||
LOG_PRINT_L3("BlockchainDB_SQLITE::" << __func__);
|
||||
auto insert_payment = prepared_st(
|
||||
"INSERT INTO batched_payments_accrued (address, amount) VALUES (?, ?)"
|
||||
|
@ -158,7 +158,7 @@ namespace cryptonote {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BlockchainSQLite::subtract_sn_payments(std::vector<cryptonote::batch_sn_payment>& payments) {
|
||||
bool BlockchainSQLite::subtract_sn_rewards(const std::vector<cryptonote::batch_sn_payment>& payments) {
|
||||
LOG_PRINT_L3("BlockchainDB_SQLITE::" << __func__);
|
||||
auto update_payment = prepared_st(
|
||||
"UPDATE batched_payments_accrued SET amount = (amount - ?) WHERE address = ?");
|
||||
|
@ -414,7 +414,10 @@ namespace cryptonote {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BlockchainSQLite::validate_batch_payment(std::vector<std::tuple<crypto::public_key, uint64_t>> miner_tx_vouts, std::vector<cryptonote::batch_sn_payment> calculated_payments_from_batching_db, uint64_t block_height) {
|
||||
bool BlockchainSQLite::validate_batch_payment(
|
||||
const std::vector<std::tuple<crypto::public_key, uint64_t>>& miner_tx_vouts,
|
||||
const std::vector<cryptonote::batch_sn_payment>& calculated_payments_from_batching_db,
|
||||
uint64_t block_height) {
|
||||
LOG_PRINT_L3("BlockchainDB_SQLITE::" << __func__);
|
||||
size_t length_miner_tx_vouts = miner_tx_vouts.size();
|
||||
size_t length_calculated_payments_from_batching_db = calculated_payments_from_batching_db.size();
|
||||
|
@ -425,11 +428,11 @@ namespace cryptonote {
|
|||
}
|
||||
|
||||
int8_t vout_index = 0;
|
||||
uint64_t total_oxen_payout_in_our_db = std::accumulate(calculated_payments_from_batching_db.begin(), calculated_payments_from_batching_db.end(), uint64_t(0), [](auto
|
||||
const a, auto
|
||||
const b) {
|
||||
return a + b.amount;
|
||||
});
|
||||
uint64_t total_oxen_payout_in_our_db = std::accumulate(
|
||||
calculated_payments_from_batching_db.begin(),
|
||||
calculated_payments_from_batching_db.end(),
|
||||
uint64_t(0),
|
||||
[](auto&& a, auto&& b) { return a + b.amount; });
|
||||
uint64_t total_oxen_payout_in_vouts = 0;
|
||||
std::vector<batch_sn_payment> finalised_payments;
|
||||
cryptonote::keypair
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
|
||||
|
||||
// add_sn_payments/subtract_sn_payments -> passing an array of addresses and amounts. These will be added or subtracted to the database for each address specified. If the address does not exist it will be created.
|
||||
bool add_sn_payments(std::vector<cryptonote::batch_sn_payment>& payments);
|
||||
bool subtract_sn_payments(std::vector<cryptonote::batch_sn_payment>& payments);
|
||||
bool add_sn_rewards(const std::vector<cryptonote::batch_sn_payment>& payments);
|
||||
bool subtract_sn_rewards(const std::vector<cryptonote::batch_sn_payment>& payments);
|
||||
|
||||
// get_payments -> passing a block height will return an array of payments that should be created in a coinbase transaction on that block given the current batching DB state.
|
||||
std::optional<std::vector<cryptonote::batch_sn_payment>> get_sn_payments(uint64_t block_height);
|
||||
|
@ -79,7 +79,10 @@ public:
|
|||
bool pop_block(const cryptonote::block& block, const service_nodes::service_node_list::state_t& service_nodes_state);
|
||||
|
||||
// validate_batch_payment -> used to make sure that list of miner_tx_vouts is correct. Compares the miner_tx_vouts with a list previously extracted payments to make sure that the correct persons are being paid.
|
||||
bool validate_batch_payment(std::vector<std::tuple<crypto::public_key, uint64_t>> miner_tx_vouts, std::vector<cryptonote::batch_sn_payment> calculated_payments_from_batching_db, uint64_t block_height);
|
||||
bool validate_batch_payment(
|
||||
const std::vector<std::tuple<crypto::public_key, uint64_t>>& miner_tx_vouts,
|
||||
const std::vector<cryptonote::batch_sn_payment>& calculated_payments_from_batching_db,
|
||||
uint64_t block_height);
|
||||
|
||||
// these keep track of payments made to SN operators after then payment has been made. Allows for popping blocks back and knowing who got paid in those blocks.
|
||||
// passing in a list of people to be marked as paid in the paid_amounts vector. Block height will be added to the batched_payments_paid database as height_paid.
|
||||
|
|
Loading…
Reference in New Issue