Skip to content

Commit bf95ab4

Browse files
authored
Latest develop to master #788
2 parents 43785d6 + 034d3d7 commit bf95ab4

File tree

7 files changed

+172
-8
lines changed

7 files changed

+172
-8
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 4)
4-
define(_CLIENT_VERSION_MINOR, 1)
4+
define(_CLIENT_VERSION_MINOR, 2)
55
define(_CLIENT_VERSION_REVISION, 0)
66
define(_CLIENT_VERSION_BUILD, 0)
77
define(_CLIENT_VERSION_IS_RELEASE, true)

src/qt/assetsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void AssetsDialog::on_sendButton_clicked()
366366
std::vector< std::pair<CAssetTransfer, std::string> >vTransfers;
367367

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

372372
// Always use a CCoinControl instance, use the AssetControlDialog instance if CoinControl has been enabled

src/qt/sendassetsentry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ SendAssetsRecipient SendAssetsEntry::getValue()
303303
recipient.address = ui->payTo->text();
304304
recipient.label = ui->addAsLabel->text();
305305
recipient.amount = ui->payAssetAmount->value();
306-
recipient.message = ui->messageTextLabel->text();
306+
recipient.message = ui->memoBox->text();
307307

308308
return recipient;
309309
}

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ UniValue decodescript(const JSONRPCRequest& request)
16251625
r.push_back(Pair("asset_name", transfer.strName));
16261626
r.push_back(Pair("amount", ValueFromAmount(transfer.nAmount)));
16271627
if (!transfer.message.empty())
1628-
r.push_back(Pair("message", transfer.message));
1628+
r.push_back(Pair("message", EncodeAssetData(transfer.message)));
16291629
if (transfer.nExpireTime)
16301630
r.push_back(Pair("expire_time", transfer.nExpireTime));
16311631

src/version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
// Update these four values on every release cycle
1414
// These values should match the values in configure.ac
1515
// Used for checking the Ravencoin releases on github
16-
static const std::string SOFTWARE_VERSION = "v4.1.0";
16+
static const std::string SOFTWARE_VERSION = "v4.2.0";
1717
static const int MAIN_SOFTWARE_VERSION = 4;
18-
static const int SECOND_SOFTWARE_VERSION = 1;
18+
static const int SECOND_SOFTWARE_VERSION = 2;
1919
static const int THIRD_SOFTWARE_VERSION = 0;
2020

21-
static const int PROTOCOL_VERSION = 70027;
21+
static const int PROTOCOL_VERSION = 70028;
2222

2323
//! initial proto version, to be increased after version/verack negotiation
2424
static const int INIT_PROTO_VERSION = 209;

src/wallet/rpcdump.cpp

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,14 @@ UniValue dumpwallet(const JSONRPCRequest& request)
669669
CRavenExtKey b58extkey;
670670
b58extkey.SetKey(masterKey);
671671

672+
CExtPubKey pubkey;
673+
pubkey = masterKey.Neuter();
674+
675+
CRavenExtPubKey b58extpubkey;
676+
b58extpubkey.SetKey(pubkey);
677+
672678
file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n";
679+
file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n";
673680
}
674681
}
675682

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

700+
CExtPubKey pubkey;
701+
pubkey = masterKey.Neuter();
702+
703+
CRavenExtPubKey b58extpubkey;
704+
b58extpubkey.SetKey(pubkey);
705+
693706
file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n";
707+
file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n";
694708

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

746+
UniValue getmasterkeyinfo(const JSONRPCRequest& request)
747+
{
748+
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
749+
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
750+
return NullUniValue;
751+
}
752+
753+
if (request.fHelp || request.params.size() != 0)
754+
throw std::runtime_error(
755+
"getmasterkeyinfo\n"
756+
"\nFetches and displays the master private key and the master public key.\n"
757+
"\nResult:\n"
758+
"{ (json object)\n"
759+
" \"bip32_root_private\" : (string) extended master private key,\n"
760+
" \"bip32_root_public\" : (string) extended master public key,\n"
761+
" \"account_derivation_path\" : (string) The derivation path to the account public/private keys\n"
762+
" \"account_extended_private_key\" : (string) extended account private key,\n"
763+
" \"account_extended_public_key\" : (string) extended account public key,\n"
764+
"}\n"
765+
"\nExamples:\n"
766+
+ HelpExampleCli("getmasterkeyinfo", "")
767+
+ HelpExampleRpc("getmasterkeyinfo", "")
768+
);
769+
770+
LOCK2(cs_main, pwallet->cs_wallet);
771+
772+
EnsureWalletIsUnlocked(pwallet);
773+
774+
UniValue ret(UniValue::VOBJ);
775+
776+
// add the base58check encoded extended master if the wallet uses HD
777+
CKeyID seed_id = pwallet->GetHDChain().seed_id;
778+
if (!seed_id.IsNull())
779+
{
780+
781+
if (!pwallet->GetHDChain().IsBip44()) {
782+
CKey seed;
783+
if (pwallet->GetKey(seed_id, seed)) {
784+
785+
// Create the master key
786+
CExtKey masterKey;
787+
masterKey.SetSeed(seed.begin(), seed.size());;
788+
789+
// Get the Raven Ext Key from the master key
790+
CRavenExtKey b58extkey;
791+
b58extkey.SetKey(masterKey);
792+
793+
// Get the public key from the master key
794+
CExtPubKey pubkey;
795+
pubkey = masterKey.Neuter();
796+
797+
// Get the Raven Ext Key from the public key
798+
CRavenExtPubKey b58extpubkey;
799+
b58extpubkey.SetKey(pubkey);
800+
801+
// Add the private and public key to the output
802+
ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString()));
803+
ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString()));
804+
ret.push_back(std::make_pair("account_derivation_path", "m/0'"));
805+
806+
CExtKey accountKey;
807+
// derive m/account'
808+
masterKey.Derive(accountKey, 0 | 0x80000000);
809+
810+
// Create the account public key from the account private key
811+
CExtPubKey account_extended_public_key;
812+
account_extended_public_key = accountKey.Neuter();
813+
814+
// Create the Raven Account Ext Private Key
815+
CRavenExtKey b58accountextprivatekey;
816+
b58accountextprivatekey.SetKey(accountKey);
817+
818+
// Create the Raven Account Ext Public Key
819+
CRavenExtPubKey b58actextpubkey;
820+
b58actextpubkey.SetKey(account_extended_public_key);
821+
822+
// Add the account extended public and private keys to the return
823+
ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString()));
824+
ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString()));
825+
826+
}
827+
}
828+
829+
if(pwallet->GetHDChain().IsBip44())
830+
{
831+
CWalletDB walletdb(pwallet->GetDBHandle());
832+
833+
std::vector<unsigned char> vchWords;
834+
std::vector<unsigned char> vchPassphrase;
835+
std::vector<unsigned char> vchSeed;
836+
uint256 hash;
837+
838+
pwallet->GetBip39Data(hash, vchWords, vchPassphrase, vchSeed);
839+
840+
// Create the master key
841+
CExtKey masterKey;
842+
masterKey.SetSeed(vchSeed.data(), vchSeed.size());
843+
844+
// Get the Raven Ext Key from the master key
845+
CRavenExtKey b58extkey;
846+
b58extkey.SetKey(masterKey);
847+
848+
// Get the public key from the master key
849+
CExtPubKey pubkey;
850+
pubkey = masterKey.Neuter();
851+
852+
// Get the Raven Ext Key from the public key
853+
CRavenExtPubKey b58extpubkey;
854+
b58extpubkey.SetKey(pubkey);
855+
856+
// Add the private and public key to the output
857+
ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString()));
858+
ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString()));
859+
std::string path = strprintf("m/44'/%d'/%d'", GetParams().ExtCoinType(), 0);
860+
ret.push_back(std::make_pair("account_derivation_path", path));
861+
862+
// Lets generate the account private and public keys
863+
CExtKey purposeKey;
864+
CExtKey coinTypeKey;
865+
CExtKey accountKey;
866+
// derive m/purpose'
867+
masterKey.Derive(purposeKey, 44 | 0x80000000);
868+
// derive m/purpose'/coin_type'
869+
purposeKey.Derive(coinTypeKey, GetParams().ExtCoinType() | 0x80000000);
870+
// derive m/purpose'/coin_type'/account'
871+
coinTypeKey.Derive(accountKey, 0 | 0x80000000);
872+
873+
// Create the account public key from the account private key
874+
CExtPubKey account_extended_public_key;
875+
account_extended_public_key = accountKey.Neuter();
876+
877+
// Create the Raven Account Ext Private Key
878+
CRavenExtKey b58accountextprivatekey;
879+
b58accountextprivatekey.SetKey(accountKey);
880+
881+
// Create the Raven Account Ext Public Key
882+
CRavenExtPubKey b58actextpubkey;
883+
b58actextpubkey.SetKey(account_extended_public_key);
884+
885+
// Add the account extended public and private keys to the return
886+
ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString()));
887+
ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString()));
888+
}
889+
}
890+
891+
return ret;
892+
}
893+
732894

733895
UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp)
734896
{

src/wallet/rpcwallet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3514,6 +3514,7 @@ extern UniValue importprivkey(const JSONRPCRequest& request);
35143514
extern UniValue importaddress(const JSONRPCRequest& request);
35153515
extern UniValue importpubkey(const JSONRPCRequest& request);
35163516
extern UniValue dumpwallet(const JSONRPCRequest& request);
3517+
extern UniValue getmasterkeyinfo(const JSONRPCRequest& request);
35173518
extern UniValue importwallet(const JSONRPCRequest& request);
35183519
extern UniValue importprunedfunds(const JSONRPCRequest& request);
35193520
extern UniValue removeprunedfunds(const JSONRPCRequest& request);
@@ -3538,7 +3539,8 @@ static const CRPCCommand commands[] =
35383539
{ "wallet", "getaccount", &getaccount, {"address"} },
35393540
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, {"account"} },
35403541
{ "wallet", "getbalance", &getbalance, {"account","minconf","include_watchonly"} },
3541-
{ "wallet", "getmywords", &getmywords, {} },
3542+
{ "wallet", "getmasterkeyinfo", &getmasterkeyinfo, {} },
3543+
{ "wallet", "getmywords", &getmywords, {} },
35423544
{ "wallet", "getnewaddress", &getnewaddress, {"account"} },
35433545
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, {} },
35443546
{ "wallet", "getreceivedbyaccount", &getreceivedbyaccount, {"account","minconf"} },

0 commit comments

Comments
 (0)