Skip to content

Commit

Permalink
Latest develop to master #788
Browse files Browse the repository at this point in the history
  • Loading branch information
blondfrogs authored Jul 2, 2020
2 parents 43785d6 + 034d3d7 commit bf95ab4
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 8 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 4)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
Expand Down
2 changes: 1 addition & 1 deletion src/qt/assetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void AssetsDialog::on_sendButton_clicked()
std::vector< std::pair<CAssetTransfer, std::string> >vTransfers;

for (auto recipient : recipients) {
vTransfers.emplace_back(std::make_pair(CAssetTransfer(recipient.assetName.toStdString(), recipient.amount), recipient.address.toStdString()));
vTransfers.emplace_back(std::make_pair(CAssetTransfer(recipient.assetName.toStdString(), recipient.amount, DecodeAssetData(recipient.message.toStdString()), 0), recipient.address.toStdString()));
}

// Always use a CCoinControl instance, use the AssetControlDialog instance if CoinControl has been enabled
Expand Down
2 changes: 1 addition & 1 deletion src/qt/sendassetsentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ SendAssetsRecipient SendAssetsEntry::getValue()
recipient.address = ui->payTo->text();
recipient.label = ui->addAsLabel->text();
recipient.amount = ui->payAssetAmount->value();
recipient.message = ui->messageTextLabel->text();
recipient.message = ui->memoBox->text();

return recipient;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ UniValue decodescript(const JSONRPCRequest& request)
r.push_back(Pair("asset_name", transfer.strName));
r.push_back(Pair("amount", ValueFromAmount(transfer.nAmount)));
if (!transfer.message.empty())
r.push_back(Pair("message", transfer.message));
r.push_back(Pair("message", EncodeAssetData(transfer.message)));
if (transfer.nExpireTime)
r.push_back(Pair("expire_time", transfer.nExpireTime));

Expand Down
6 changes: 3 additions & 3 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// Update these four values on every release cycle
// These values should match the values in configure.ac
// Used for checking the Ravencoin releases on github
static const std::string SOFTWARE_VERSION = "v4.1.0";
static const std::string SOFTWARE_VERSION = "v4.2.0";
static const int MAIN_SOFTWARE_VERSION = 4;
static const int SECOND_SOFTWARE_VERSION = 1;
static const int SECOND_SOFTWARE_VERSION = 2;
static const int THIRD_SOFTWARE_VERSION = 0;

static const int PROTOCOL_VERSION = 70027;
static const int PROTOCOL_VERSION = 70028;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
162 changes: 162 additions & 0 deletions src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,14 @@ UniValue dumpwallet(const JSONRPCRequest& request)
CRavenExtKey b58extkey;
b58extkey.SetKey(masterKey);

CExtPubKey pubkey;
pubkey = masterKey.Neuter();

CRavenExtPubKey b58extpubkey;
b58extpubkey.SetKey(pubkey);

file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n";
file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n";
}
}

Expand All @@ -690,7 +697,14 @@ UniValue dumpwallet(const JSONRPCRequest& request)
CRavenExtKey b58extkey;
b58extkey.SetKey(masterKey);

CExtPubKey pubkey;
pubkey = masterKey.Neuter();

CRavenExtPubKey b58extpubkey;
b58extpubkey.SetKey(pubkey);

file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n";
file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n";

file << "# HD seed: " << HexStr(vchSeed) << "\n";
file << "# mnemonic: " << std::string(vchWords.begin(), vchWords.end()).c_str() << "\n";
Expand Down Expand Up @@ -729,6 +743,154 @@ UniValue dumpwallet(const JSONRPCRequest& request)
return reply;
}

UniValue getmasterkeyinfo(const JSONRPCRequest& request)
{
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}

if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getmasterkeyinfo\n"
"\nFetches and displays the master private key and the master public key.\n"
"\nResult:\n"
"{ (json object)\n"
" \"bip32_root_private\" : (string) extended master private key,\n"
" \"bip32_root_public\" : (string) extended master public key,\n"
" \"account_derivation_path\" : (string) The derivation path to the account public/private keys\n"
" \"account_extended_private_key\" : (string) extended account private key,\n"
" \"account_extended_public_key\" : (string) extended account public key,\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getmasterkeyinfo", "")
+ HelpExampleRpc("getmasterkeyinfo", "")
);

LOCK2(cs_main, pwallet->cs_wallet);

EnsureWalletIsUnlocked(pwallet);

UniValue ret(UniValue::VOBJ);

// add the base58check encoded extended master if the wallet uses HD
CKeyID seed_id = pwallet->GetHDChain().seed_id;
if (!seed_id.IsNull())
{

if (!pwallet->GetHDChain().IsBip44()) {
CKey seed;
if (pwallet->GetKey(seed_id, seed)) {

// Create the master key
CExtKey masterKey;
masterKey.SetSeed(seed.begin(), seed.size());;

// Get the Raven Ext Key from the master key
CRavenExtKey b58extkey;
b58extkey.SetKey(masterKey);

// Get the public key from the master key
CExtPubKey pubkey;
pubkey = masterKey.Neuter();

// Get the Raven Ext Key from the public key
CRavenExtPubKey b58extpubkey;
b58extpubkey.SetKey(pubkey);

// Add the private and public key to the output
ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString()));
ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString()));
ret.push_back(std::make_pair("account_derivation_path", "m/0'"));

CExtKey accountKey;
// derive m/account'
masterKey.Derive(accountKey, 0 | 0x80000000);

// Create the account public key from the account private key
CExtPubKey account_extended_public_key;
account_extended_public_key = accountKey.Neuter();

// Create the Raven Account Ext Private Key
CRavenExtKey b58accountextprivatekey;
b58accountextprivatekey.SetKey(accountKey);

// Create the Raven Account Ext Public Key
CRavenExtPubKey b58actextpubkey;
b58actextpubkey.SetKey(account_extended_public_key);

// Add the account extended public and private keys to the return
ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString()));
ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString()));

}
}

if(pwallet->GetHDChain().IsBip44())
{
CWalletDB walletdb(pwallet->GetDBHandle());

std::vector<unsigned char> vchWords;
std::vector<unsigned char> vchPassphrase;
std::vector<unsigned char> vchSeed;
uint256 hash;

pwallet->GetBip39Data(hash, vchWords, vchPassphrase, vchSeed);

// Create the master key
CExtKey masterKey;
masterKey.SetSeed(vchSeed.data(), vchSeed.size());

// Get the Raven Ext Key from the master key
CRavenExtKey b58extkey;
b58extkey.SetKey(masterKey);

// Get the public key from the master key
CExtPubKey pubkey;
pubkey = masterKey.Neuter();

// Get the Raven Ext Key from the public key
CRavenExtPubKey b58extpubkey;
b58extpubkey.SetKey(pubkey);

// Add the private and public key to the output
ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString()));
ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString()));
std::string path = strprintf("m/44'/%d'/%d'", GetParams().ExtCoinType(), 0);
ret.push_back(std::make_pair("account_derivation_path", path));

// Lets generate the account private and public keys
CExtKey purposeKey;
CExtKey coinTypeKey;
CExtKey accountKey;
// derive m/purpose'
masterKey.Derive(purposeKey, 44 | 0x80000000);
// derive m/purpose'/coin_type'
purposeKey.Derive(coinTypeKey, GetParams().ExtCoinType() | 0x80000000);
// derive m/purpose'/coin_type'/account'
coinTypeKey.Derive(accountKey, 0 | 0x80000000);

// Create the account public key from the account private key
CExtPubKey account_extended_public_key;
account_extended_public_key = accountKey.Neuter();

// Create the Raven Account Ext Private Key
CRavenExtKey b58accountextprivatekey;
b58accountextprivatekey.SetKey(accountKey);

// Create the Raven Account Ext Public Key
CRavenExtPubKey b58actextpubkey;
b58actextpubkey.SetKey(account_extended_public_key);

// Add the account extended public and private keys to the return
ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString()));
ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString()));
}
}

return ret;
}


UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp)
{
Expand Down
4 changes: 3 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3514,6 +3514,7 @@ extern UniValue importprivkey(const JSONRPCRequest& request);
extern UniValue importaddress(const JSONRPCRequest& request);
extern UniValue importpubkey(const JSONRPCRequest& request);
extern UniValue dumpwallet(const JSONRPCRequest& request);
extern UniValue getmasterkeyinfo(const JSONRPCRequest& request);
extern UniValue importwallet(const JSONRPCRequest& request);
extern UniValue importprunedfunds(const JSONRPCRequest& request);
extern UniValue removeprunedfunds(const JSONRPCRequest& request);
Expand All @@ -3538,7 +3539,8 @@ static const CRPCCommand commands[] =
{ "wallet", "getaccount", &getaccount, {"address"} },
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, {"account"} },
{ "wallet", "getbalance", &getbalance, {"account","minconf","include_watchonly"} },
{ "wallet", "getmywords", &getmywords, {} },
{ "wallet", "getmasterkeyinfo", &getmasterkeyinfo, {} },
{ "wallet", "getmywords", &getmywords, {} },
{ "wallet", "getnewaddress", &getnewaddress, {"account"} },
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, {} },
{ "wallet", "getreceivedbyaccount", &getreceivedbyaccount, {"account","minconf"} },
Expand Down

0 comments on commit bf95ab4

Please sign in to comment.