mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Wallet, RPC, bitcoin-tx, etc updates for confidential transactions
This commit is contained in:
parent
74987d30b1
commit
292f923d03
29 changed files with 968 additions and 175 deletions
|
|
@ -193,6 +193,11 @@ bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
|
|||
return WriteAccountingEntry(++nAccountingEntryNumber, acentry);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteBlindingKey(const CKey& privKey)
|
||||
{
|
||||
return Write(std::string("blindingkey"), std::vector<unsigned char>(privKey.begin(), privKey.end()));
|
||||
}
|
||||
|
||||
CAmount CWalletDB::GetAccountCreditDebit(const string& strAccount)
|
||||
{
|
||||
list<CAccountingEntry> entries;
|
||||
|
|
@ -590,6 +595,16 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (strType == "blindingkey")
|
||||
{
|
||||
assert(!pwallet->blinding_key.IsValid());
|
||||
std::vector<unsigned char> vchBlindingKey;
|
||||
ssValue >> vchBlindingKey;
|
||||
pwallet->blinding_key.Set(vchBlindingKey.begin(), vchBlindingKey.end(), true);
|
||||
if (pwallet->blinding_key.IsValid()) {
|
||||
pwallet->blinding_pubkey = pwallet->blinding_key.GetPubKey();
|
||||
}
|
||||
}
|
||||
} catch (...)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -701,6 +716,12 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
if (wss.fAnyUnordered)
|
||||
result = ReorderTransactions(pwallet);
|
||||
|
||||
if (!pwallet->blinding_key.IsValid()) {
|
||||
pwallet->blinding_key.MakeNewKey(true);
|
||||
pwallet->blinding_pubkey = pwallet->blinding_key.GetPubKey();
|
||||
WriteBlindingKey(pwallet->blinding_key);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue