New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move CWalletDB::ReorderTransactions to CWallet #8828
Move CWalletDB::ReorderTransactions to CWallet #8828
Conversation
@@ -155,6 +155,7 @@ class CWalletDB : public CDB | |||
|
|||
/// This writes directly to the database, and will not update the CWallet's cached accounting entries! | |||
/// Use wallet.AddAccountingEntry instead, to write *and* update its caches. | |||
bool WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this a line down because of the comment?
test_bitcoin fails here:
|
Concept ACK |
Regarding the Travis issue, I can reproduce this locally simply by running test_bitcoin:
Assembly code:
Looks lke a jump "between instructions" or such. Likely a messedup function pointer or other memory corruption. Weird. |
{ | ||
CWalletTx *const pwtx = (*it).second.first; | ||
CAccountingEntry *const pacentry = (*it).second.second; | ||
int64_t& nOrderPos = (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+wallet/wallet.cpp:684:14: warning: declaration shadows a field of 'CWallet' [-Wshadow]
+ int64_t& nOrderPosNext = nOrderPosNext;
+ ^
+./wallet/wallet.h:659:13: note: previous declaration is here
+ int64_t nOrderPosNext;
+ ^
+wallet/wallet.cpp:684:30: warning: reference 'nOrderPosNext' is not yet bound to a value when used within its own initialization [-Wuninitialized]
+ int64_t& nOrderPosNext = nOrderPosNext;
+ ~~~~~~~~~~~~~ ^~~~~~~~~~~~~
+2 warnings generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed that is the issue
txByTime.insert(make_pair(entry.nTime, TxPair((CWalletTx*)0, &entry))); | ||
} | ||
|
||
int64_t& nOrderPosNext = nOrderPosNext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this is the culprit. It's creating a strange circular reference.
With this line removed it passes the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pstratem Are you still working on this?
653f361
to
86029e7
Compare
86029e7 Move CWalletDB::ReorderTransactions to CWallet (Patrick Strateman)
86029e7 Move CWalletDB::ReorderTransactions to CWallet (Patrick Strateman)
86029e7 Move CWalletDB::ReorderTransactions to CWallet (Patrick Strateman)
86029e7 Move CWalletDB::ReorderTransactions to CWallet (Patrick Strateman)
[Backport] bitcoin/bitcoin#13825 kill accounts This is a backport of the following commits: - from bitcoin/bitcoin#13825 - pick bitcoin/bitcoin@c9c32e6 - from bitcoin/bitcoin#14023 - pick bitcoin/bitcoin@f0dc850 - from bitcoin/bitcoin#13566 - pick bitcoin/bitcoin@702ae1e - pick bitcoin/bitcoin@cf15761 - pick bitcoin/bitcoin@0f3d6e9 - pick bitcoin/bitcoin@7110c83 - pick bitcoin/bitcoin@ef7bc88 - pick bitcoin/bitcoin@4279da4 - pick bitcoin/bitcoin@c410f41 - from bitcoin/bitcoin#9614 - pick bitcoin/bitcoin@02d9f50 - pick bitcoin/bitcoin@82b7dc3 - from bitcoin/bitcoin#8061 - pick bitcoin/bitcoin@ecb9741 - from bitcoin/bitcoin#6851 - pick bitcoin/bitcoin@3e7c89196c - from bitcoin/bitcoin#8828 - pick bitcoin/bitcoin@86029e7 - from bitcoin/bitcoin#8696 - just the first two commits, as AccountingEntry is going away - pick bitcoin/bitcoin@d2e678d - pick bitcoin/bitcoin@59adc86 - from bitcoin/bitcoin#8028 - pick bitcoin/bitcoin@0fd5997
CWalletDB was never the right place for this.