Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Allred
crown-core
Commits
e94010b2
Commit
e94010b2
authored
13 years ago
by
Jeff Garzik
Browse files
Options
Download
Plain Diff
Merge pull request #383 from sipa/syncdefault
Fix synchronization of default key
parents
bb0d9ce2
e9f61c87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ui.cpp
+1
-1
src/ui.cpp
src/wallet.cpp
+14
-10
src/wallet.cpp
src/wallet.h
+1
-0
src/wallet.h
with
16 additions
and
11 deletions
+16
-11
src/ui.cpp
View file @
e94010b2
...
...
@@ -240,7 +240,7 @@ void SetDefaultReceivingAddress(const string& strAddress)
return
;
if
(
!
mapPubKeys
.
count
(
hash160
))
return
;
CWalletDB
(
pwalletMain
->
strWalletFile
).
Write
DefaultKey
(
mapPubKeys
[
hash160
]);
pwalletMain
->
Set
DefaultKey
(
mapPubKeys
[
hash160
]);
pframeMain
->
m_textCtrlAddress
->
SetValue
(
strAddress
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/wallet.cpp
View file @
e94010b2
...
...
@@ -98,14 +98,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
BOOST_FOREACH
(
const
CTxOut
&
txout
,
wtx
.
vout
)
{
if
(
txout
.
scriptPubKey
==
scriptDefaultKey
)
{
if
(
!
fFileBacked
)
continue
;
CWalletDB
walletdb
(
strWalletFile
);
vchDefaultKey
=
GetKeyFromKeyPool
();
walletdb
.
WriteDefaultKey
(
vchDefaultKey
);
walletdb
.
WriteName
(
PubKeyToAddress
(
vchDefaultKey
),
""
);
}
SetDefaultKey
(
GetKeyFromKeyPool
());
}
// Notify UI
...
...
@@ -967,10 +960,9 @@ bool CWallet::LoadWallet(bool& fFirstRunRet)
// Create new default key
RandAddSeedPerfmon
();
vch
DefaultKey
=
GetKeyFromKeyPool
();
Set
DefaultKey
(
GetKeyFromKeyPool
()
)
;
if
(
!
SetAddressBookName
(
PubKeyToAddress
(
vchDefaultKey
),
""
))
return
false
;
CWalletDB
(
strWalletFile
).
WriteDefaultKey
(
vchDefaultKey
);
}
CreateThread
(
ThreadFlushWalletDB
,
&
strWalletFile
);
...
...
@@ -1022,6 +1014,17 @@ bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx)
return
false
;
}
bool
CWallet
::
SetDefaultKey
(
const
std
::
vector
<
unsigned
char
>
&
vchPubKey
)
{
if
(
fFileBacked
)
{
if
(
!
CWalletDB
(
strWalletFile
).
WriteDefaultKey
(
vchPubKey
))
return
false
;
}
vchDefaultKey
=
vchPubKey
;
return
true
;
}
bool
GetWalletFile
(
CWallet
*
pwallet
,
string
&
strWalletFileOut
)
{
if
(
!
pwallet
->
fFileBacked
)
...
...
@@ -1133,3 +1136,4 @@ void CReserveKey::ReturnKey()
nIndex
=
-
1
;
vchPubKey
.
clear
();
}
This diff is collapsed.
Click to expand it.
src/wallet.h
View file @
e94010b2
...
...
@@ -176,6 +176,7 @@ public:
bool
GetTransaction
(
const
uint256
&
hashTx
,
CWalletTx
&
wtx
);
bool
SetDefaultKey
(
const
std
::
vector
<
unsigned
char
>
&
vchPubKey
);
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help