Merge commit '85962ee8e21c145d67dd249c5df250be8b3ab75d' into MergeUpstream3

This commit is contained in:
Doyle 2020-05-21 16:11:23 +10:00
commit 371d8b68d9
5 changed files with 14 additions and 2 deletions

View File

@ -1157,7 +1157,8 @@ namespace cryptonote { namespace rpc {
res.block_reward = lMiner.get_block_reward();
}
const account_public_address& lMiningAdr = lMiner.get_mining_address();
res.address = get_account_address_as_str(nettype(), false, lMiningAdr);
if (lMiner.is_mining())
res.address = get_account_address_as_str(nettype(), false, lMiningAdr);
const uint8_t major_version = m_core.get_blockchain_storage().get_current_hard_fork_version();
res.pow_algorithm =

View File

@ -6030,6 +6030,7 @@ transfer_view wallet2::make_transfer_view(const crypto::hash &txid, const crypto
result.was_blink = pd.m_was_blink;
// TODO(sacha): is this just for in or also coinbase?
const bool unlocked = is_transfer_unlocked(result.unlock_time, result.height, result.blink_mempool);
result.locked = !unlocked;
result.lock_msg = unlocked ? "unlocked" : "locked";
set_confirmations(result, get_blockchain_current_height(), get_last_block_reward());
result.checkpointed = (result.height == 0 && pd.m_unmined_blink ? false : result.height <= m_immutable_height);
@ -6047,6 +6048,7 @@ transfer_view wallet2::wallet2::make_transfer_view(const crypto::hash &txid, con
result.height = pd.m_block_height;
result.timestamp = pd.m_timestamp;
result.unlock_time = pd.m_unlock_time;
result.locked = !is_transfer_unlocked(pd.m_unlock_time, pd.m_block_height, false);
result.fee = pd.m_amount_in - pd.m_amount_out;
uint64_t change = pd.m_change == (uint64_t)-1 ? 0 : pd.m_change; // change may not be known
result.amount = pd.m_amount_in - change - result.fee;
@ -6085,6 +6087,7 @@ transfer_view wallet2::make_transfer_view(const crypto::hash &txid, const tools:
result.fee = pd.m_amount_in - pd.m_amount_out;
result.amount = pd.m_amount_in - pd.m_change - result.fee;
result.unlock_time = pd.m_tx.unlock_time;
result.locked = true;
result.note = get_tx_note(txid);
for (const auto &d: pd.m_dests) {
@ -6117,6 +6120,7 @@ transfer_view wallet2::make_transfer_view(const crypto::hash &payment_id, const
result.timestamp = pd.m_timestamp;
result.amount = pd.m_amount;
result.unlock_time = pd.m_unlock_time;
result.locked = true;
result.fee = pd.m_fee;
result.note = get_tx_note(pd.m_tx_hash);
result.double_spend_seen = ppd.m_double_spend_seen;

View File

@ -259,6 +259,7 @@ private:
std::list<transfer_destination> destinations; // Array of transfer destinations.
std::string type; // Type of transfer, one of the following: "in", "out", "stake", "miner", "snode", "gov", "pending", "failed", "pool".
uint64_t unlock_time; // Number of blocks until transfer is safely spendable.
bool locked; // If the transfer is locked or not
cryptonote::subaddress_index subaddr_index; // Major & minor index, account and subaddress index respectively.
std::vector<cryptonote::subaddress_index> subaddr_indices;
std::string address; // Address that transferred the funds.

View File

@ -170,6 +170,7 @@ namespace tools
if (m_wallet)
{
m_wallet->store();
m_wallet->deinit();
m_wallet.reset();
}
}
@ -1584,6 +1585,7 @@ namespace tools
rpc_payment.amount = payment.m_amount;
rpc_payment.block_height = payment.m_block_height;
rpc_payment.unlock_time = payment.m_unlock_time;
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.m_unlock_time, payment.m_block_height, payment.m_unmined_blink);
rpc_payment.subaddr_index = payment.m_subaddr_index;
rpc_payment.address = m_wallet->get_subaddress_as_str(payment.m_subaddr_index);
res.payments.push_back(rpc_payment);
@ -1613,6 +1615,7 @@ namespace tools
rpc_payment.unlock_time = payment.second.m_unlock_time;
rpc_payment.subaddr_index = payment.second.m_subaddr_index;
rpc_payment.address = m_wallet->get_subaddress_as_str(payment.second.m_subaddr_index);
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.second.m_unlock_time, payment.second.m_block_height, payment.second.m_unmined_blink);
res.payments.push_back(std::move(rpc_payment));
}
@ -1667,6 +1670,7 @@ namespace tools
rpc_payment.unlock_time = payment.m_unlock_time;
rpc_payment.subaddr_index = payment.m_subaddr_index;
rpc_payment.address = m_wallet->get_subaddress_as_str(payment.m_subaddr_index);
rpc_payment.locked = !m_wallet->is_transfer_unlocked(payment.m_unlock_time, payment.m_block_height, payment.m_unmined_blink);
res.payments.push_back(std::move(rpc_payment));
}
}

View File

@ -48,7 +48,7 @@
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1
#define WALLET_RPC_VERSION_MINOR 13
#define WALLET_RPC_VERSION_MINOR 14
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
namespace tools
@ -918,6 +918,7 @@ namespace wallet_rpc
uint64_t amount; // Amount for this payment.
uint64_t block_height; // Height of the block that first confirmed this payment.
uint64_t unlock_time; // Time (in block height) until this payment is safe to spend.
bool locked; // If the payment is spendable or not
cryptonote::subaddress_index subaddr_index; // Major & minor index, account and subaddress index respectively.
std::string address; // Address receiving the payment.
@ -927,6 +928,7 @@ namespace wallet_rpc
KV_SERIALIZE(amount)
KV_SERIALIZE(block_height)
KV_SERIALIZE(unlock_time)
KV_SERIALIZE(locked)
KV_SERIALIZE(subaddr_index)
KV_SERIALIZE(address)
END_KV_SERIALIZE_MAP()