From 9903bc0d7229d446d9efd874ccef2fb59b2cf610 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Mon, 7 Mar 2016 04:54:01 +0300 Subject: [PATCH] It's senseless to import pubkey pair address. --- src/qt/multisigdialog.cpp | 4 ++-- src/rpcdump.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qt/multisigdialog.cpp b/src/qt/multisigdialog.cpp index 6013c79..8f9beea 100644 --- a/src/qt/multisigdialog.cpp +++ b/src/qt/multisigdialog.cpp @@ -312,7 +312,7 @@ void MultisigDialog::on_createTransactionButton_clicked() SendCoinsRecipient recipient = entry->getValue(); CBitcoinAddress address(recipient.address.toStdString()); CScript scriptPubKey; - scriptPubKey.SetDestination(address.Get()); + scriptPubKey.SetAddress(address); int64_t amount = recipient.amount; CTxOut output(amount, scriptPubKey); transaction.vout.push_back(output); @@ -657,4 +657,4 @@ void MultisigDialog::keyPressEvent(QKeyEvent *event) close(); } #endif -} \ No newline at end of file +} diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 6e72688..1499ace 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -101,13 +101,14 @@ Value importaddress(const Array& params, bool fHelp) CScript script; CBitcoinAddress address(params[0].get_str()); if (address.IsValid()) { - script.SetDestination(address.Get()); + if (address.IsPair()) + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "It's senseless to import pubkey pair address."); + script.SetAddress(address); } else if (IsHex(params[0].get_str())) { std::vector data(ParseHex(params[0].get_str())); script = CScript(data.begin(), data.end()); - } else { + } else throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Novacoin address or script"); - } string strLabel = ""; if (params.size() > 1) @@ -161,13 +162,14 @@ Value removeaddress(const Array& params, bool fHelp) CBitcoinAddress address(params[0].get_str()); if (address.IsValid()) { - script.SetDestination(address.Get()); + if (address.IsPair()) + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey pair addresses aren't supported."); + script.SetAddress(address); } else if (IsHex(params[0].get_str())) { std::vector data(ParseHex(params[0].get_str())); script = CScript(data.begin(), data.end()); - } else { + } else throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address or script"); - } if (::IsMine(*pwalletMain, script) == MINE_SPENDABLE) throw JSONRPCError(RPC_WALLET_ERROR, "The wallet contains the private key for this address or script - can't remove it"); -- 1.7.1