本文整理汇总了C++中CBitcoinAddress类的典型用法代码示例。如果您正苦于以下问题:C++ CBitcoinAddress类的具体用法?C++ CBitcoinAddress怎么用?C++ CBitcoinAddress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBitcoinAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsMasterKey
bool COeruShield::IsMasterKey(CBitcoinAddress addr) const
{
std::string strAddr = addr.ToString();
std::vector<unsigned char> hash;
hash.resize(CSHA256::OUTPUT_SIZE);
CSHA256().Write((unsigned char*) &strAddr[0], strAddr.size())
.Finalize(&hash[0]);
return IsMasterKey(hash);
}
示例2: dumpprivkey
Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <fuhcoinaddress>\n"
"Reveals the private key corresponding to <fuhcoinaddress>.");
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid fuhcoin address");
CKeyID keyID;
if (!address.GetKeyID(keyID))
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
CSecret vchSecret;
bool fCompressed;
if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
return CBitcoinSecret(vchSecret, fCompressed).ToString();
}
示例3: dumpprivkey
Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <smallchange address>\n"
"Reveals the private key corresponding to <smallchange address>.");
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(-5, "Invalid SmallChange address");
CKeyID keyID;
if (!address.GetKeyID(keyID))
throw JSONRPCError(-3, "Address does not refer to a key");
CSecret vchSecret;
bool fCompressed;
if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
throw JSONRPCError(-4,"Private key for address " + strAddress + " is not known");
return CBitcoinSecret(vchSecret, fCompressed).ToString();
}
示例4: dumpprivkey
Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <ppcoinaddress>\n"
"Reveals the private key corresponding to <ppcoinaddress>.");
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(-5, "Invalid ppcoin address");
if (pwalletMain->IsLocked())
throw JSONRPCError(-13, "Error: Please enter the wallet passphrase with walletpassphrase first.");
if (fWalletUnlockMintOnly) // ppcoin: no dumpprivkey in mint-only mode
throw JSONRPCError(-102, "Wallet is unlocked for minting only.");
CSecret vchSecret;
bool fCompressed;
if (!pwalletMain->GetSecret(address, vchSecret, fCompressed))
throw JSONRPCError(-4,"Private key for address " + strAddress + " is not known");
return CBitcoinSecret(vchSecret, fCompressed).ToString();
}
示例5: CBitcoinAddress
bool COeruShield::GetDestinationAddress(const CTxOut txOut, CBitcoinAddress &destination) const
{
CTxDestination txDestination;
if (!ExtractDestination(txOut.scriptPubKey, txDestination))
return false;
destination = CBitcoinAddress(txDestination);
if (!destination.IsValid())
return false;
return true;
}
示例6: refreshAddressTable
void refreshAddressTable()
{
cachedAddressTable.clear();
{
LOCK(wallet->cs_wallet);
BOOST_FOREACH(const PAIRTYPE(CTxDestination, std::string)& item, wallet->mapAddressBook)
{
const CBitcoinAddress address(item.first, wallet->GetUnit());
const std::string& strName = item.second;
bool fMine = IsMine(*wallet, address.Get());
CPeercoinAddress dividendAddress;
if (wallet->GetUnit() == 'S')
dividendAddress = CPeercoinAddress(address);
cachedAddressTable.append(AddressTableEntry(fMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending,
QString::fromStdString(strName),
QString::fromStdString(address.ToString()),
QString::fromStdString(dividendAddress.ToString())));
}
}
}
示例7: AddressToString
std::string AddressToString(const CBitcoinAddress& Address)
{
std::string TxLabels[] =
{
_("Date"),
_("Hash"),
_("From"),
_("Amount"),
_("To"),
_("Amount"),
_("Delta"),
_("Balance")};
std::string TxContent = table + makeHTMLTableRow(TxLabels, sizeof(TxLabels) / sizeof(std::string));
std::set<COutPoint> PrevOuts;
/*
CScript AddressScript;
AddressScript.SetDestination(Address.Get());
CAmount Sum = 0;
bool fAddrIndex = false;
if (!fAddrIndex)
return ""; // it will take too long to find transactions by address
else
{
std::vector<CDiskTxPos> Txs;
paddressmap->GetTxs(Txs, AddressScript.GetID());
BOOST_FOREACH (const CDiskTxPos& pos, Txs)
{
CTransaction tx;
CBlock block;
uint256 bhash = block.GetHash();
GetTransaction(pos.nTxOffset, tx, bhash);
std::map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(block.GetHash());
if (mi == mapBlockIndex.end())
continue;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !chainActive.Contains(pindex))
continue;
std::string Prepend = "<a href=\"" + itostr(pindex->nHeight) + "\">" + TimeToString(pindex->nTime) + "</a>";
TxContent += TxToRow(tx, AddressScript, Prepend, &Sum);
}
}
*/
TxContent += "</table>";
std::string Content;
Content += "<h1>" + _("Transactions to/from") + " <span>" + Address.ToString() + "</span></h1>";
Content += TxContent;
return Content;
}
示例8: dumpprivkey
Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <Blackwhitecoinaddress>\n"
"Reveals the private key corresponding to <Blackwhitecoinaddress>.");
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Blackwhitecoin address");
if (fWalletUnlockMintOnly) // ppcoin: no dumpprivkey in mint-only mode
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Wallet is unlocked for minting only.");
CKeyID keyID;
if (!address.GetKeyID(keyID))
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");
CSecret vchSecret;
bool fCompressed;
if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed))
throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + strAddress + " is not known");
return CBitcoinSecret(vchSecret, fCompressed).ToString();
}
示例9: AddRawTxNameOperation
/**
* Implement the rawtx name operation feature. This routine interprets
* the given JSON object describing the desired name operation and then
* modifies the transaction accordingly.
* @param tx The transaction to extend.
* @param obj The name operation "description" as given to the call.
*/
void
AddRawTxNameOperation (CMutableTransaction& tx, const UniValue& obj)
{
UniValue val = find_value (obj, "op");
if (!val.isStr ())
throw JSONRPCError (RPC_INVALID_PARAMETER, "missing op key");
const std::string op = val.get_str ();
if (op != "name_update")
throw JSONRPCError (RPC_INVALID_PARAMETER,
"only name_update is implemented for the rawtx API");
val = find_value (obj, "name");
if (!val.isStr ())
throw JSONRPCError (RPC_INVALID_PARAMETER, "missing name key");
const valtype name = ValtypeFromString (val.get_str ());
val = find_value (obj, "value");
if (!val.isStr ())
throw JSONRPCError (RPC_INVALID_PARAMETER, "missing value key");
const valtype value = ValtypeFromString (val.get_str ());
val = find_value (obj, "address");
if (!val.isStr ())
throw JSONRPCError (RPC_INVALID_PARAMETER, "missing address key");
const CBitcoinAddress toAddress(val.get_str ());
if (!toAddress.IsValid ())
throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, "invalid address");
const CScript addr = GetScriptForDestination (toAddress.Get ());
tx.SetNamecoin ();
/* We do not add the name input. This has to be done explicitly,
but is easy from the name_show output. That way, createrawtransaction
doesn't depend on the chainstate at all. */
const CScript outScript = CNameScript::buildNameUpdate (addr, name, value);
tx.vout.push_back (CTxOut (NAME_LOCKED_AMOUNT, outScript));
}
示例10: QWidget
MiningPage::MiningPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::MiningPage),
hasMiningprivkey(false)
{
ui->setupUi(this);
int nThreads = boost::thread::hardware_concurrency();
int nUseThreads = GetArg("-genproclimit", -1);
if (nUseThreads < 0)
nUseThreads = nThreads;
std::string PrivAddress = GetArg("-miningprivkey", "");
if (!PrivAddress.empty())
{
CBitcoinSecret Secret;
Secret.SetString(PrivAddress);
if (Secret.IsValid())
{
CBitcoinAddress Address;
Address.Set(Secret.GetKey().GetPubKey().GetID());
ui->labelAddress->setText(QString("All mined coins will go to to %1").arg(Address.ToString().c_str()));
hasMiningprivkey = true;
}
}
ui->sliderCores->setMinimum(0);
ui->sliderCores->setMaximum(nThreads);
ui->sliderCores->setValue(nUseThreads);
ui->labelNCores->setText(QString("%1").arg(nUseThreads));
connect(ui->sliderCores, SIGNAL(valueChanged(int)), this, SLOT(changeNumberOfCores(int)));
connect(ui->pushSwitchMining, SIGNAL(clicked()), this, SLOT(switchMining()));
updateUI();
startTimer(1500);
}
示例11: vchName
void SendCoinsEntry::on_payTo_editingFinished()
{
QString name = ui->payTo->text();
if (name.isEmpty())
return;
std::string strName = name.toStdString();
std::vector<unsigned char> vchName(strName.begin(), strName.end());
std::string error;
CBitcoinAddress address;
if (!GetNameCurrentAddress(vchName, address, error))
return;
QString qstrAddress = QString::fromStdString(address.ToString());
if (QMessageBox::Yes != QMessageBox::question(this, tr("Confirm name as address"),
tr("This name exist and still active. Do you wish to use address of its current owner - %1?").arg(qstrAddress),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel))
return;
else
ui->payTo->setText(qstrAddress);
}
示例12: BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(rpc_addmultisig, TestNetFixture)
{
rpcfn_type addmultisig = tableRPC["addmultisigaddress"]->actor;
// old, 65-byte-long:
const char address1Hex[] = "0434e3e09f49ea168c5bbf53f877ff6606923858aab7c7e1df25bc263978107c95e35065a27ef6f1b27222db0ec97e0e895eaca603d3ee0d4c060ce3d8a00286c8";
// new, compressed:
const char address2Hex[] = "0388c2037017c62240b6b72ac1a2a5f94da790596ebd06177c8572752922165cb4";
Value v;
CBitcoinAddress address;
BOOST_CHECK_NO_THROW(v = addmultisig(createArgs(1, address1Hex), false));
address.SetString(v.get_str());
BOOST_CHECK(address.IsValid() && address.IsScript());
BOOST_CHECK_NO_THROW(v = addmultisig(createArgs(1, address1Hex, address2Hex), false));
address.SetString(v.get_str());
BOOST_CHECK(address.IsValid() && address.IsScript());
BOOST_CHECK_NO_THROW(v = addmultisig(createArgs(2, address1Hex, address2Hex), false));
address.SetString(v.get_str());
BOOST_CHECK(address.IsValid() && address.IsScript());
BOOST_CHECK_THROW(addmultisig(createArgs(0), false), runtime_error);
BOOST_CHECK_THROW(addmultisig(createArgs(1), false), runtime_error);
BOOST_CHECK_THROW(addmultisig(createArgs(2, address1Hex), false), runtime_error);
BOOST_CHECK_THROW(addmultisig(createArgs(1, ""), false), runtime_error);
BOOST_CHECK_THROW(addmultisig(createArgs(1, "NotAValidPubkey"), false), runtime_error);
string short1(address1Hex, address1Hex+sizeof(address1Hex)-2); // last byte missing
BOOST_CHECK_THROW(addmultisig(createArgs(2, short1.c_str()), false), runtime_error);
string short2(address1Hex+1, address1Hex+sizeof(address1Hex)); // first byte missing
BOOST_CHECK_THROW(addmultisig(createArgs(2, short2.c_str()), false), runtime_error);
}
示例13: on_enableButton_clicked
void AutoSavingsDialog::on_enableButton_clicked()
{
if(model->getEncryptionStatus() == WalletModel::Locked)
{
ui->message->setStyleSheet("QLabel { color: black; }");
ui->message->setText(tr("Please unlock wallet before starting auto savings."));
return;
}
bool fValidConversion = false;
int64 nMinAmount = MIN_TXOUT_AMOUNT;
int64 nMaxAmount = MAX_MONEY;
CBitcoinAddress changeAddress = "";
CBitcoinAddress address = ui->savingsAddressEdit->text().toStdString();
if (!address.IsValid())
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("The entered address:\n") + ui->savingsAddressEdit->text() + tr(" is invalid.\nPlease check the address and try again."));
ui->savingsAddressEdit->setFocus();
return;
}
int nSavingsPercent = ui->savingsPercentEdit->text().toInt(&fValidConversion, 10);
if (!fValidConversion || nSavingsPercent > 50 || nSavingsPercent <= 0)
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("Please Enter 1 - 50 for percent."));
ui->savingsPercentEdit->setFocus();
return;
}
if (!ui->savingsMinEdit->text().isEmpty())
{
nMinAmount = ui->savingsMinEdit->text().toDouble(&fValidConversion) * COIN;
if(!fValidConversion || nMinAmount <= MIN_TXOUT_AMOUNT || nMinAmount >= MAX_MONEY )
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("Min Amount out of Range, please re-enter."));
ui->savingsMinEdit->setFocus();
return;
}
}
if (!ui->savingsMaxEdit->text().isEmpty())
{
nMaxAmount = ui->savingsMaxEdit->text().toDouble(&fValidConversion) * COIN;
if(!fValidConversion || nMaxAmount <= MIN_TXOUT_AMOUNT || nMaxAmount >= MAX_MONEY )
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("Max Amount out of Range, please re-enter."));
ui->savingsMaxEdit->setFocus();
return;
}
}
if (nMinAmount >= nMaxAmount)
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("Min Amount > Max Amount, please re-enter."));
ui->savingsMinEdit->setFocus();
return;
}
if (!ui->savingsChangeAddressEdit->text().isEmpty())
{
changeAddress = ui->savingsChangeAddressEdit->text().toStdString();
if (!changeAddress.IsValid())
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("The entered change address:\n") + ui->savingsChangeAddressEdit->text() + tr(" is invalid.\nPlease check the address and try again."));
ui->savingsChangeAddressEdit->setFocus();
return;
}
else if (!model->isMine(changeAddress))
{
ui->message->setStyleSheet("QLabel { color: red; }");
ui->message->setText(tr("The entered change address:\n") + ui->savingsChangeAddressEdit->text() + tr(" is not owned.\nPlease check the address and try again."));
ui->savingsChangeAddressEdit->setFocus();
return;
}
}
model->setAutoSavings(true, nSavingsPercent, address, changeAddress, nMinAmount, nMaxAmount);
ui->message->setStyleSheet("QLabel { color: green; }");
ui->message->setText(tr("You are now saving to\n") + QString(address.ToString().c_str()) + tr("."));
return;
}
示例14: RunSerialiseTests
void RunSerialiseTests()
{
int64_t nTest;
int64_t nTest0 = 0l;
int64_t nTest4 = 1432035740l;
int64_t nTest4_1 = 2189410940l; // 2039
int64_t nTest5 = 4294967298l; // 2106
int64_t nTest8 = -3l;
BOOST_CHECK(0 == GetNumBytesReqForInt(nTest0));
BOOST_CHECK(4 == GetNumBytesReqForInt(nTest4));
BOOST_CHECK(4 == GetNumBytesReqForInt(nTest4_1)); // expect 4, no sign bit
BOOST_CHECK(5 == GetNumBytesReqForInt(nTest5));
BOOST_CHECK(8 == GetNumBytesReqForInt(nTest8));
//BOOST_MESSAGE(GetNumBytesReqForInt(nTest5));
std::vector<uint8_t> v;
SetCompressedInt64(v, nTest0);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest0 == nTest);
SetCompressedInt64(v, nTest5);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest5 == nTest);
SetCompressedInt64(v, nTest8);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest8 == nTest);
CStoredExtKey sk, sk_;
CStoredExtKey skInvalid, skInvalid_;
CExtKey58 eKey58;
BOOST_CHECK(0 == eKey58.Set58("sdcvmnKmFxG9k6UnN3wyLpTv83G1wgYEz1m21rZTUUimoDrYYMrZXUycudse21EZJTmkBBPN3k6Qhfzx5td8xzd9W893YhNozA3bZW3yVLVdrZU2"));
sk.kp = eKey58.GetKey();
sk.sLabel = "sk label";
sk.nGenerated = 5;
sk.nHGenerated = 6;
sk.mapValue[EKVT_CREATED_AT] = SetCompressedInt64(v, nTest8);
eKey58.SetKey(sk.kp, CChainParams::EXT_PUBLIC_KEY);
BOOST_CHECK(eKey58.ToString() == "sdcpmphCJNSUos9rNqn6FNi3ztvMW1wft1PVbifvBrwhm6JnhD9yk8rSNFTGfozGbmBsr8vZv9mGYSTfmEMpbfTTMb8TQfj7JRABmvBFKgA2xG8J");
eKey58.SetKeyV(sk.kp);
BOOST_CHECK(eKey58.ToString() == "sdcvmnKmFxG9k6UnN3wyLpTv83G1wgYEz1m21rZTUUimoDrYYMrZXUycudse21EZJTmkBBPN3k6Qhfzx5td8xzd9W893YhNozA3bZW3yVLVdrZU2");
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << sk << skInvalid;
ss >> sk_;
ss >> skInvalid_;
BOOST_CHECK(sk.kp == sk_.kp);
BOOST_CHECK(1 == sk_.kp.IsValidV());
BOOST_CHECK(1 == sk_.kp.IsValidP());
BOOST_CHECK(sk.sLabel == sk_.sLabel);
BOOST_CHECK(sk.nGenerated == sk_.nGenerated);
BOOST_CHECK(sk.nHGenerated == sk_.nHGenerated);
BOOST_CHECK(nTest8 == GetCompressedInt64(sk_.mapValue[EKVT_CREATED_AT], (uint64_t&)nTest));
BOOST_CHECK(0 == skInvalid.kp.IsValidV());
BOOST_CHECK(0 == skInvalid.kp.IsValidP());
// path
std::vector<uint8_t> vPath;
PushUInt32(vPath, 1);
PushUInt32(vPath, 3);
PushUInt32(vPath, 2);
PushUInt32(vPath, 4294967295);
std::string sPath;
BOOST_CHECK(0 == PathToString(vPath, sPath, 'h'));
BOOST_CHECK(sPath == "m/1/3/2/2147483647h");
vPath.resize(0);
PushUInt32(vPath, 1);
PushUInt32(vPath, 4294967294);
PushUInt32(vPath, 30);
BOOST_CHECK(0 == PathToString(vPath, sPath));
BOOST_CHECK(sPath == "m/1/2147483646'/30");
// id
CBitcoinAddress addr;
CKeyID id = sk.GetID();
CKeyID idTest;
BOOST_CHECK(true == addr.Set(id, CChainParams::EXT_KEY_HASH)
&& addr.IsValid(CChainParams::EXT_KEY_HASH)
&& addr.GetKeyID(idTest, CChainParams::EXT_KEY_HASH));
//.........这里部分代码省略.........
示例15: RunSerialiseTests
void RunSerialiseTests()
{
int64_t nTest;
int64_t nTest0 = 0l;
int64_t nTest4 = 1432035740l;
int64_t nTest4_1 = 2189410940l; // 2039
int64_t nTest5 = 4294967298l; // 2106
int64_t nTest8 = -3l;
BOOST_CHECK(0 == GetNumBytesReqForInt(nTest0));
BOOST_CHECK(4 == GetNumBytesReqForInt(nTest4));
BOOST_CHECK(4 == GetNumBytesReqForInt(nTest4_1)); // expect 4, no sign bit
BOOST_CHECK(5 == GetNumBytesReqForInt(nTest5));
BOOST_CHECK(8 == GetNumBytesReqForInt(nTest8));
//BOOST_TEST_MESSAGE(GetNumBytesReqForInt(nTest5));
std::vector<uint8_t> v;
SetCompressedInt64(v, nTest0);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest0 == nTest);
SetCompressedInt64(v, nTest5);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest5 == nTest);
SetCompressedInt64(v, nTest8);
GetCompressedInt64(v, (uint64_t&)nTest);
BOOST_CHECK(nTest8 == nTest);
CStoredExtKey sk, sk_;
CStoredExtKey skInvalid, skInvalid_;
CExtKey58 eKey58;
BOOST_CHECK(0 == eKey58.Set58("moivYMcZoUdupxqBNASoNKWbyBzKFPzYA3ZauZhCyQGcUhdvxhgsYNdqBkCbspTmaXWtW68Ha7gjMBjb5gbudrictnzw9KAVKogAXC8FsqiSzRp"));
sk.kp = eKey58.GetKey();
sk.sLabel = "sk label";
sk.nGenerated = 5;
sk.nHGenerated = 6;
sk.mapValue[EKVT_CREATED_AT] = SetCompressedInt64(v, nTest8);
eKey58.SetKey(sk.kp, CChainParams::EXT_PUBLIC_KEY);
BOOST_CHECK(eKey58.ToString() == "moipXY9njTPCnsVV8vPCLA1xKp2NXdRtPVyGABKcbshkKQUadnrk2XPccZcSDjefRX64mNjYpS33SAy97UHGWs9WoAufi9pdow9gsYMvVEcmgSk");
eKey58.SetKeyV(sk.kp);
BOOST_CHECK(eKey58.ToString() == "moivYMcZoUdupxqBNASoNKWbyBzKFPzYA3ZauZhCyQGcUhdvxhgsYNdqBkCbspTmaXWtW68Ha7gjMBjb5gbudrictnzw9KAVKogAXC8FsqiSzRp");
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << sk << skInvalid;
ss >> sk_;
ss >> skInvalid_;
BOOST_CHECK(sk.kp == sk_.kp);
BOOST_CHECK(1 == sk_.kp.IsValidV());
BOOST_CHECK(1 == sk_.kp.IsValidP());
BOOST_CHECK(sk.sLabel == sk_.sLabel);
BOOST_CHECK(sk.nGenerated == sk_.nGenerated);
BOOST_CHECK(sk.nHGenerated == sk_.nHGenerated);
BOOST_CHECK(nTest8 == GetCompressedInt64(sk_.mapValue[EKVT_CREATED_AT], (uint64_t&)nTest));
BOOST_CHECK(0 == skInvalid.kp.IsValidV());
BOOST_CHECK(0 == skInvalid.kp.IsValidP());
// path
std::vector<uint8_t> vPath;
PushUInt32(vPath, 1);
PushUInt32(vPath, 3);
PushUInt32(vPath, 2);
PushUInt32(vPath, 4294967295);
std::string sPath;
BOOST_CHECK(0 == PathToString(vPath, sPath, 'h'));
BOOST_CHECK(sPath == "m/1/3/2/2147483647h");
vPath.resize(0);
PushUInt32(vPath, 1);
PushUInt32(vPath, 4294967294);
PushUInt32(vPath, 30);
BOOST_CHECK(0 == PathToString(vPath, sPath));
BOOST_CHECK(sPath == "m/1/2147483646'/30");
// id
CBitcoinAddress addr;
CKeyID id = sk.GetID();
CKeyID idTest;
BOOST_CHECK(true == addr.Set(id, CChainParams::EXT_KEY_HASH)
&& addr.IsValid(CChainParams::EXT_KEY_HASH)
&& addr.GetKeyID(idTest, CChainParams::EXT_KEY_HASH));
//.........这里部分代码省略.........