CBitcoinAddress address(strAddress);
if (address.IsValid())
- scriptPubKey.SetDestination(address.Get());
+ scriptPubKey.SetAddress(address);
else
- {
- CMalleablePubKey mpk(strAddress);
- if (!mpk.IsValid())
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid NovaCoin address");
-
- CPubKey R, pubKeyVariant;
- mpk.GetVariant(R, pubKeyVariant);
- scriptPubKey.SetDestination(R, pubKeyVariant);
- }
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid NovaCoin address");
// Amount
int64_t nAmount = AmountFromValue(params[1]);
CBitcoinAddress address(strAddress);
if (address.IsValid())
- scriptPubKey.SetDestination(address.Get());
+ scriptPubKey.SetAddress(address);
else
- {
- CMalleablePubKey mpk(strAddress);
- if (!mpk.IsValid())
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid NovaCoin address");
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid NovaCoin address");
- CPubKey R, pubKeyVariant;
- mpk.GetVariant(R, pubKeyVariant);
- scriptPubKey.SetDestination(R, pubKeyVariant);
- }
int64_t nAmount = AmountFromValue(params[2]);
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid NovaCoin address: ")+s.name_);
- if (setAddress.count(address))
- throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
- setAddress.insert(address);
+ if (!address.IsPair())
+ {
+ if (setAddress.count(address))
+ throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
+ setAddress.insert(address);
+ }
CScript scriptPubKey;
- scriptPubKey.SetDestination(address.Get());
+ scriptPubKey.SetAddress(address);
int64_t nAmount = AmountFromValue(s.value_);
if (nAmount < nMinimumInputValue)
ret.push_back(Pair("isvalid", isValid));
if (isValid)
{
- CTxDestination dest = address.Get();
- string currentAddress = address.ToString();
- ret.push_back(Pair("address", currentAddress));
- isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : MINE_NO;
- ret.push_back(Pair("ismine", mine != MINE_NO));
- if (mine != MINE_NO) {
- ret.push_back(Pair("watchonly", mine == MINE_WATCH_ONLY));
- Object detail = boost::apply_visitor(DescribeAddressVisitor(mine), dest);
- ret.insert(ret.end(), detail.begin(), detail.end());
+ if (address.IsPair())
+ {
+ CMalleablePubKey mpk;
+ mpk.setvch(address.GetData());
+ ret.push_back(Pair("ispair", true));
+
+ CMalleableKeyView view;
+ bool isMine = pwalletMain->GetMalleableView(mpk, view);
+ ret.push_back(Pair("ismine", isMine));
+
+ if (isMine)
+ ret.push_back(Pair("KeyView", view.ToString()));
+ }
+ else
+ {
+ CTxDestination dest = address.Get();
+ string currentAddress = address.ToString();
+ ret.push_back(Pair("address", currentAddress));
+ isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : MINE_NO;
+ ret.push_back(Pair("ismine", mine != MINE_NO));
+ if (mine != MINE_NO) {
+ ret.push_back(Pair("watchonly", mine == MINE_WATCH_ONLY));
+ Object detail = boost::apply_visitor(DescribeAddressVisitor(mine), dest);
+ ret.insert(ret.end(), detail.begin(), detail.end());
+ }
+ if (pwalletMain->mapAddressBook.count(dest))
+ ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest]));
}
- if (pwalletMain->mapAddressBook.count(dest))
- ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest]));
}
return ret;
}
throw runtime_error("Unable to generate new malleable key");
CMalleablePubKey mPubKey = mKey.GetMalleablePubKey();
- CDataStream ssPublicBytes(SER_NETWORK, PROTOCOL_VERSION);
- ssPublicBytes << mPubKey;
Object result;
result.push_back(Pair("PublicPair", mPubKey.ToString()));
- result.push_back(Pair("PublicBytes", HexStr(ssPublicBytes.begin(), ssPublicBytes.end())));
+ result.push_back(Pair("PublicBytes", HexStr(mPubKey.Raw())));
+ result.push_back(Pair("Address", CBitcoinAddress(mPubKey).ToString()));
result.push_back(Pair("KeyView", keyView.ToString()));
return result;
}
-Value validatemalleablepubkey(const Array& params, bool fHelp)
-{
- if (fHelp || params.size() != 1)
- throw runtime_error(
- "validatemalleablekey <Malleable public key data>\n"
- "Check the validity and ownership for priovided malleable public key.\n");
-
- CMalleablePubKey mpk;
- bool isValid = mpk.SetString(params[0].get_str());
-
- Object result;
- result.push_back(Pair("isvalid", isValid));
-
- if (isValid)
- {
- CMalleableKeyView view;
- bool isMine = pwalletMain->GetMalleableView(mpk, view);
- result.push_back(Pair("ismine", isMine));
-
- if (isMine)
- result.push_back(Pair("KeyView", view.ToString()));
- }
-
- return result;
-}
-
Value adjustmalleablekey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 3)
CMalleablePubKey malleablePubKey;
if (pubKeyPair.size() == 136) {
- CDataStream ssPublicBytes(ParseHex(pubKeyPair), SER_NETWORK, PROTOCOL_VERSION);
- ssPublicBytes >> malleablePubKey;
+ malleablePubKey.setvch(ParseHex(pubKeyPair));
} else
malleablePubKey.SetString(pubKeyPair);