-
Notifications
You must be signed in to change notification settings - Fork 725
[Refactor] Mix refactoring in preparation for DMN lists #2270
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
[Refactor] Mix refactoring in preparation for DMN lists #2270
Conversation
73ca597 to
9a1948e
Compare
9a1948e to
23e8c3e
Compare
23e8c3e to
a361805
Compare
src/wallet/wallet.cpp
Outdated
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.
I'm thinking about this, why this is needed?
In the FundTransaction flow, the user is providing the tx in hex format and the node is parsing it. If there would be an extra payload or sapling data inside the tx, this line GetSerializeSize(tx) + extraSize will sum them twice as GetSerializeSize calls internally to the tx serialization method which is already taking into account the two fields.
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.
In the FundTransaction flow, the user is providing the tx in hex format and the node is parsing it.
Mhm... there is some confusion.
This is the wallet function. There is no hex format, or parsing, directly involved here.
A generic caller to CWallet::FundTransaction provides the transaction to be funded, as a CMutableTransaction tx (not an hex string).
The outputs of this mutable tx are used to fill vecSend, passed to CWallet::CreateTransaction.
With the input data, CreateTransaction creates a mutable transaction object txNew.
Since, in order to select enough inputs, the transaction fee must be known, the serialized size is calculated inside CreateTransaction.
This calculation is obviously done on the newly created CMutableTransaction (the txNew object), which has no extra payload accounted for.
Also, while currently CWallet::FundTransaction is called exclusively from the RPC command fundrawtransaction (after parsing the user provided hex), soon there will be more RPCs (which involve no parsing of raw txes) relying on this wallet function.
this line GetSerializeSize(tx) + extraSize will sum them twice
No. You can easily verify, trying to remove this on #2267.
The tests will fail due to fee too low.
Also note that txNew is being serialized (not the mutable tx passed to FundTransaction).
a361805 to
be31458
Compare
be31458 to
0b9a21f
Compare
Also rename 'tiertwo' folder to 'evo'
>>> Inspired by bitcoin#11864 (+bitcoin#10784) Since CreateTransaction still needs cs_main we need to obtain both locks in FundTransaction, to preserve locking order. After introducing the chain interface (bitcoin#14437) we can change the LOCK2(cs_main, cs_wallet) to just LOCK(cs_wallet)
0b9a21f to
65b6bd3
Compare
Since we will need the current tip index in CheckProRegTx to check for duplicate unique-properties in the deterministic mn list.
the boolean argument fJustCheck in ProcessSpecialTxsInBlock will be used later, after the connection to the deterministic manager
Also don't expose it (as it is only called by ContextualCheckZerocoinTx) and cleanup logs with __func__
e263d9c to
3490971
Compare
3490971 to
b408de3
Compare
furszy
left a comment
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.
Looking better now 👌 , nice work.
ACK b408de3 .
|
Would be good to complete the review and merge this one (opened 2 weeks ago), so we can keep going with the DMN stuff. |
Fuzzbawls
left a comment
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.
Code ACK b408de3
|
Merging... |
c27bbed [Cleanup] functions impl: branch on new line (random-zebra) 8850b3e [Refactoring] Make CEvoDB mutex public (random-zebra) 304fc46 Take memory used by CEvoDB/CDBTransaction into account when flushing (random-zebra) ed0d4f9 Track memory usage in CDBTransaction and CEvoDB (random-zebra) f259774 Implement CDBTransactionIterator (Alexander Block) 51920cb Change CDBTransaction to compare keys by their serialized form (Alexander Block) 7094a60 Support passing CDataStream as key into CDBWrapper/CDBBatch/CDBIterator (Alexander Block) cdd44d4 [Cleanup] Drop unneeded casts (random-zebra) 65b8ddc [DB] Specialize CScopedDBTransaction for evo database (random-zebra) 34a7541 [Refactoring] Properly add explicit specifier where appropriate (random-zebra) 6a36968 Implement 2-stage commit for CEvoDB to avoid inconsistencies (Alexander Block) e6c7efe [Refactoring] Let Commit() return void (random-zebra) fec56b0 [DB] Ensure evoDB consistency by storing best block hash (random-zebra) be85c9a [Refactoring] migrate evoDb to unique pointer (random-zebra) cab50d3 [Tests] Fix functional test suite with new directory 'evodb' (random-zebra) ad7f5d7 [DB][BUG] Add virtual destructor for KeyValueHolder (random-zebra) d6c56d1 Introduce CEvoDB for all evo related things, e.g. DIP3 (Alexander Block) 2496933 Implement CDBTransaction and CScopedDBTransaction (Alexander Block) da6a2c1 [Build] CMake: Introduce evo headers (random-zebra) f3a7cfb [Trivial] Remove unused variable in ProcessNewBlock (random-zebra) Pull request description: Extracted from #2267. This introduces the new database, used for all DMN-related things, and updates the dbWrapper. Builds on top of: - [x] #2269 - [x] #2270 ACKs for top commit: Fuzzbawls: Code ACK c27bbed furszy: Code ACK c27bbed. Tree-SHA512: a93b0c96759b9493659d2e5c69d2fa9d7dbcb260b7f7ec4d2e7db2d1f2a4561f9548bbe4db07272792b5d6dbf33fd8e7c84f04d958781e6d9bb3fb1fdcbf2ea1
Extracted from #2267.
This is a collection of small refactorings around the validation code, which will make future additions easier to review.
See individual commit's description.