Skip to content

1346 Full Cache Mempool Transaction (unsafe mempool) #1359

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

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

1346 Full Cache Mempool Transaction (unsafe mempool) #1359

wants to merge 14 commits into from

Conversation

sukrawidhyawan
Copy link
Contributor

@sukrawidhyawan sukrawidhyawan commented Nov 20, 2020

Description

Implement Unsave mempool transaction to reduce write data into DB base.
Current implementation when last incoming transaction less than 1 second OR unsafe cache mempool not empty new incoming transaction will come to full cache mempool.
Full cache mempool will move into normal mempool (DBmempool) in every 5second

Breakdown

  • Add Spendadble Balance Storage
  • Implement Unsave ApplyUnconfirmed & EscrowApplyUnconfirmed to save transaction into full cache mempool
  • Add AddAccountSpendableBalanceInCache & UpdateAccountSpendableBalanceInCache in Balance Helper
  • Add Scheduler to move full cache mempool (unsave mempool) into normal mempool

Reference Issue

Close #1346

Step to Test (optional)

  • Run multiple local nodes
  • Spam with sending money transaction

SPam with 80tx/2s
Screen Shot 2020-11-20 at 11 26 17

Balance after spam
Screen Shot 2020-11-20 at 11 27 24

switch {
case mps.lastIncomingTransactionTime.IsZero():
isApplyInCache = false
case time.Since(mps.lastIncomingTransactionTime).Seconds() < 1, mps.MempoolUnsaveCacheStorage.GetTotalItems() > 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better to use a constant instead of hardcoded time duration. we might be able to tune this setting on high end hardware

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added, thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tech: Add Cache Storage Unsave Mempool Transaction
3 participants