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

feat(txpool): calculate consumption when committing a new block #1554

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Ja7ad
Copy link
Contributor

@Ja7ad Ja7ad commented Oct 17, 2024

Description

Calculate consumption when committing a new block

Related issue(s)

@Ja7ad Ja7ad requested a review from b00f October 17, 2024 19:29
if trx.IsTransferTx() || trx.IsBondTx() || trx.IsWithdrawTx() {
signer := trx.Payload().Signer()
if v, ok := p.consumptionMap[signer]; ok {
p.consumptionMap[signer] = v - uint32(trx.SerializeSize())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b00f I don't know on test TestCalculatingConsumption why value p.consumptionMap for specific signer don't update.

assert.False(t, td.pool.HasTx(testTrx.ID()), "Transaction should be removed")
assert.Nil(t, td.pool.PendingTx(testTrx.ID()))
}

func TestCalculatingConsumption(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b00f What case need for check consumption map? I need to more details for test cases.

@@ -325,7 +325,6 @@ func (st *state) ProposeBlock(valKey *bls.ValidatorKey, rewardAddr crypto.Addres
// Only one subsidy transaction per blk
if txs[i].IsSubsidyTx() {
st.logger.Error("found duplicated subsidy transaction", "tx", txs[i])
st.txPool.RemoveTx(txs[i].ID())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b00f Please double check for remove this line.

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.

Calculate consumption when committing a new block
1 participant