Merge pull request #3207
a99ef176
wallet-rpc: take subaddress account as arg for get_transfer_by_txid (stoffu)77125096
wallet-rpc: rename *_INDEX_OUTOFBOUND into *_INDEX_OUT_OF_BOUNDS (stoffu)
This commit is contained in:
commit
9681a885d1
@ -1889,8 +1889,15 @@ namespace tools
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.account_index >= m_wallet->get_num_subaddress_accounts())
|
||||||
|
{
|
||||||
|
er.code = WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUT_OF_BOUNDS;
|
||||||
|
er.message = "Account index is out of bound";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
|
||||||
m_wallet->get_payments(payments, 0);
|
m_wallet->get_payments(payments, 0, (uint64_t)-1, req.account_index);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
||||||
if (i->second.m_tx_hash == txid)
|
if (i->second.m_tx_hash == txid)
|
||||||
{
|
{
|
||||||
@ -1900,7 +1907,7 @@ namespace tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>> payments_out;
|
std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>> payments_out;
|
||||||
m_wallet->get_payments_out(payments_out, 0);
|
m_wallet->get_payments_out(payments_out, 0, (uint64_t)-1, req.account_index);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>>::const_iterator i = payments_out.begin(); i != payments_out.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>>::const_iterator i = payments_out.begin(); i != payments_out.end(); ++i) {
|
||||||
if (i->first == txid)
|
if (i->first == txid)
|
||||||
{
|
{
|
||||||
@ -1910,7 +1917,7 @@ namespace tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>> upayments;
|
std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>> upayments;
|
||||||
m_wallet->get_unconfirmed_payments_out(upayments);
|
m_wallet->get_unconfirmed_payments_out(upayments, req.account_index);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) {
|
||||||
if (i->first == txid)
|
if (i->first == txid)
|
||||||
{
|
{
|
||||||
@ -1922,7 +1929,7 @@ namespace tools
|
|||||||
m_wallet->update_pool_state();
|
m_wallet->update_pool_state();
|
||||||
|
|
||||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
||||||
m_wallet->get_unconfirmed_payments(pool_payments);
|
m_wallet->get_unconfirmed_payments(pool_payments, req.account_index);
|
||||||
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = pool_payments.begin(); i != pool_payments.end(); ++i) {
|
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = pool_payments.begin(); i != pool_payments.end(); ++i) {
|
||||||
if (i->second.m_pd.m_tx_hash == txid)
|
if (i->second.m_pd.m_tx_hash == txid)
|
||||||
{
|
{
|
||||||
@ -2449,12 +2456,12 @@ namespace tools
|
|||||||
}
|
}
|
||||||
catch (const error::account_index_outofbound& e)
|
catch (const error::account_index_outofbound& e)
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUTOFBOUND;
|
er.code = WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUT_OF_BOUNDS;
|
||||||
er.message = e.what();
|
er.message = e.what();
|
||||||
}
|
}
|
||||||
catch (const error::address_index_outofbound& e)
|
catch (const error::address_index_outofbound& e)
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_ADDRESS_INDEX_OUTOFBOUND;
|
er.code = WALLET_RPC_ERROR_CODE_ADDRESS_INDEX_OUT_OF_BOUNDS;
|
||||||
er.message = e.what();
|
er.message = e.what();
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
|
@ -1291,9 +1291,11 @@ namespace wallet_rpc
|
|||||||
struct request
|
struct request
|
||||||
{
|
{
|
||||||
std::string txid;
|
std::string txid;
|
||||||
|
uint32_t account_index;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(txid);
|
KV_SERIALIZE(txid);
|
||||||
|
KV_SERIALIZE_OPT(account_index, (uint32_t)0)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
#define WALLET_RPC_ERROR_CODE_WRONG_URI -11
|
#define WALLET_RPC_ERROR_CODE_WRONG_URI -11
|
||||||
#define WALLET_RPC_ERROR_CODE_WRONG_INDEX -12
|
#define WALLET_RPC_ERROR_CODE_WRONG_INDEX -12
|
||||||
#define WALLET_RPC_ERROR_CODE_NOT_OPEN -13
|
#define WALLET_RPC_ERROR_CODE_NOT_OPEN -13
|
||||||
#define WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUTOFBOUND -14
|
#define WALLET_RPC_ERROR_CODE_ACCOUNT_INDEX_OUT_OF_BOUNDS -14
|
||||||
#define WALLET_RPC_ERROR_CODE_ADDRESS_INDEX_OUTOFBOUND -15
|
#define WALLET_RPC_ERROR_CODE_ADDRESS_INDEX_OUT_OF_BOUNDS -15
|
||||||
#define WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE -16
|
#define WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE -16
|
||||||
#define WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY -17
|
#define WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY -17
|
||||||
#define WALLET_RPC_ERROR_CODE_TX_TOO_LARGE -18
|
#define WALLET_RPC_ERROR_CODE_TX_TOO_LARGE -18
|
||||||
|
Loading…
Reference in New Issue
Block a user