-
Notifications
You must be signed in to change notification settings - Fork 122
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
Prevent transactions in blocks from going below balance. #136
Conversation
fed3155
to
932a670
Compare
assert_equal(node.getblockcount(), blockcount + 1) | ||
|
||
# Account should now be empty | ||
assert_equal(node.getaccount(account), []) |
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.
Can also check the count of transactions?
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'll add it. We would expect five TXs in the block plus coinbase. This test will also be extended to include other account TXs.
bool accountConflict{false}; | ||
|
||
// Check if any custom TXs are in mempool with conflict | ||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); ++it) { |
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.
Use auto
instead of indexed_transaction_set::const_iterator
CAmount txfee = 0; | ||
|
||
// Check custom TX consensus types are now not in conflict with account layer | ||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); ++it) { |
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.
Use auto
instead of indexed_transaction_set::const_iterator
Tracks changes to account when including transactions in a blocks, this prevents an account trying to spend more than it has which is an invalid state and would be rejected. After block creation some transactions left in the mempool may then be invalid due to our bespoke account layer, we iterate over the mempool and remove any transactions that fail CheckTxInputs.