aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-06-11 09:44:13 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-06-12 16:48:41 +0100
commit63741d82644944f236c93e9f44cb988a38df1993 (patch)
tree067e2c60d2205ef97f7732ba9ebe0b586b456af2 /src/wallet/wallet_rpc_server.cpp
parentMerge pull request #312 (diff)
downloadmonero-63741d82644944f236c93e9f44cb988a38df1993.tar.xz
Integrated addresses (standard address plus payment id)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 9ef19f739..8bef8cdec 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -117,12 +117,15 @@ namespace tools
}
//------------------------------------------------------------------------------------------------------------------------------
- bool wallet_rpc_server::validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, const std::string payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er)
+ bool wallet_rpc_server::validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, std::string payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er)
{
+ crypto::hash integrated_payment_id = cryptonote::null_hash;
for (auto it = destinations.begin(); it != destinations.end(); it++)
{
cryptonote::tx_destination_entry de;
- if(!get_account_address_from_str(de.addr, m_wallet.testnet(), it->address))
+ bool has_payment_id;
+ crypto::hash new_payment_id;
+ if(!get_account_integrated_address_from_str(de.addr, has_payment_id, new_payment_id, m_wallet.testnet(), it->address))
{
er.code = WALLET_RPC_ERROR_CODE_WRONG_ADDRESS;
er.message = std::string("WALLET_RPC_ERROR_CODE_WRONG_ADDRESS: ") + it->address;
@@ -130,6 +133,17 @@ namespace tools
}
de.amount = it->amount;
dsts.push_back(de);
+
+ if (has_payment_id)
+ {
+ if (!payment_id.empty() || integrated_payment_id != cryptonote::null_hash)
+ {
+ er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID;
+ er.message = "A single payment id is allowed per transaction";
+ return false;
+ }
+ integrated_payment_id = new_payment_id;
+ }
}
if (!payment_id.empty())