Skip to content
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

add the pendingList to TXNpool #214

Closed
wants to merge 1 commit into from

Conversation

Arbio5zt
Copy link
Member

1.add the pendingList to TXNPool
2.make some optimization of TXNPool
3.delete some meaningless code
4.fixed some bugs.

  • Have Tested with 50W+ reg transactions and full process(reg+issue+transfer).
    Signed-off-by: luodanwg [email protected]

1.add the pendingList to TXNPool
2.make some optimization of TXNPool
3.delete some meaningless code
4.fixed some bugs.

Signed-off-by: luodanwg <[email protected]>
Copy link
Collaborator

@dreamfly281 dreamfly281 left a comment

Choose a reason for hiding this comment

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

add the pendingList to TXNpool
1.add the pendingList to TXNPool

Why is it introduced and intended to solve what's kind of problem?

2.make some optimization of TXNPool
3.delete some meaningless code
4.fixed some bugs.

Fix what's bugs , please specify here

if err := va.VerifyTransactionWithLedger(tx, ledger.DefaultLedger); err != nil {
return errors.New("[VerifyTransactionWithLedger] error")
}
if !node.LocalNode().ExistedID(msg.txn.Hash()) {
node.LocalNode().AppendTxnPool(&(msg.txn))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The verification functions shouldn't wrap into the appendTxnPool which have no relationship by watching the function name

Copy link
Member Author

Choose a reason for hiding this comment

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

this is the old code which i have removed out , could you check it again ,thanks.

txnCnt uint64
list map[common.Uint256]*transaction.Transaction
txProcessList // transaction which have been verifyed will put into this map
tXNPendingList // transaction which didn't pass the verify will put into this map
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this List is added and what is used for?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. txProcessList is the origin txlist.
  2. PendingList is used to store all the tx which didn't pass the validation check. which can tell the user(sdk) failed reason and which need to redo or need other operations.
  3. assetIssueSummary is used to store all the issued amount in transaction pool , so the new tx only need to check the delta amount instead of check all the tx in pool. it can reduce the process time.
  4. inputUTXOList like the Implement Transaction Verification #3 ,instead of check all the tx in pool ,only need to check the delta of new tx.

txProcessList // transaction which have been verifyed will put into this map
tXNPendingList // transaction which didn't pass the verify will put into this map
assetIssueSummary // transaction which pass the verify will summary the amout to this map
inputUTXOList // transaction which pass the verify will add the UTXO to this map
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto

hash := txn.Hash()
// TODO: Call VerifyTransactionWithTxPool to verify tx
//verify transaction with Concurrency
if err, errCode := va.VerifyTransactionCanConcurrency(txn); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It better move out the verification process from the AppendTxbPool process

txnPool.txnCnt++
txnPool.Unlock()
defer txnPool.Unlock()
if ok := txnPool.verifyTransactionWithTxPool(txn); !ok {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename the function in a meaningful and compact ways.

if cleanPool == true {
txnPool.init()
//Attention: clean the trasaction Pool with committed transactions.
func (txnPool *TXNPool) CleanSubmittedTransactions(block *ledger.Block) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The parameter here should be the transaction list instead of the the block, what's your opinion

return txnPool.getTransactionPendingReason(hash)
}

func (node *node) SynchronizeTxnPool() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function name and the behavior not 100% matching, it better using the get the neighbor node list and then request the txnpool one by one

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the origin func SynchronizeTxnPool() which i haven't changed yet.(diff tool's Highlight miss ).
I also think should picked out the nonexistent tx and request it individually . maybe the next step to handle transactions Synchronize.

}

func (txnPool *TXNPool) verifyTransactionWithTxPool(txn *transaction.Transaction) bool {
//check weather have duplicate UTXO input
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the benefit compare with verification transaction in one by one Vs verification the TXN in three different map. Any obvious performance improving in currently case?

Copy link
Collaborator

@dreamfly281 dreamfly281 left a comment

Choose a reason for hiding this comment

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

See comments

@dreamfly281
Copy link
Collaborator

resubmit the bug fix in another patch set, the multi queues design need further review

Honglei-Cong pushed a commit to Honglei-Cong/DNA that referenced this pull request Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants