1
0
Fork 0
forked from lthn/blockchain

added extra check for unlock time

This commit is contained in:
crypro.zoidberg 2019-05-09 21:37:16 +02:00
parent 929e7e6521
commit 67e900ec15
3 changed files with 20 additions and 1 deletions

View file

@ -226,6 +226,13 @@ namespace tools
m_wallet.get_payments(payment_id, payment_list); m_wallet.get_payments(payment_id, payment_list);
for (auto payment : payment_list) for (auto payment : payment_list)
{ {
if (payment.m_unlock_time && !req.allow_locked_transactions)
{
//check that transaction don't have locking for time longer then 10 blocks ahead
//TODO: add code for "unlock_time" set as timestamp, now it's all being filtered
if (payment.m_unlock_time > payment.m_block_height + WALLET_DEFAULT_TX_SPENDABLE_AGE)
continue;
}
wallet_rpc::payment_details rpc_payment; wallet_rpc::payment_details rpc_payment;
rpc_payment.payment_id = req.payment_id; rpc_payment.payment_id = req.payment_id;
rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash); rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash);
@ -257,6 +264,14 @@ namespace tools
for (auto & payment : payment_list) for (auto & payment : payment_list)
{ {
if (payment.m_unlock_time && !req.allow_locked_transactions)
{
//check that transaction don't have locking for time longer then 10 blocks ahead
//TODO: add code for "unlock_time" set as timestamp, now it's all being filtered
if (payment.m_unlock_time > payment.m_block_height + WALLET_DEFAULT_TX_SPENDABLE_AGE)
continue;
}
wallet_rpc::payment_details rpc_payment; wallet_rpc::payment_details rpc_payment;
rpc_payment.payment_id = payment_id_str; rpc_payment.payment_id = payment_id_str;
rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash); rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash);

View file

@ -277,9 +277,11 @@ namespace wallet_rpc
struct request struct request
{ {
std::string payment_id; // hex-encoded std::string payment_id; // hex-encoded
bool allow_locked_transactions;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(allow_locked_transactions)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
@ -299,10 +301,12 @@ namespace wallet_rpc
{ {
std::vector<std::string> payment_ids; std::vector<std::string> payment_ids;
uint64_t min_block_height; uint64_t min_block_height;
bool allow_locked_transactions;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(payment_ids) KV_SERIALIZE(payment_ids)
KV_SERIALIZE(min_block_height) KV_SERIALIZE(min_block_height)
KV_SERIALIZE(allow_locked_transactions)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };

View file

@ -5,7 +5,7 @@
"build":26, "build":26,
"cs":[ "cs":[
{ {
"build":27, "build":28,
"mode":3 "mode":3
} }
] ]