Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
emitter: fix adding txs
Browse files Browse the repository at this point in the history
  • Loading branch information
devintegral3 committed Sep 18, 2019
1 parent 84c5ce2 commit b350c60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gossip/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ func (em *Emitter) addTxs(e *inter.Event) *inter.Event {
if tx.Gas() < e.GasPowerLeft && e.GasPowerUsed+tx.Gas() < maxGasUsed {
e.GasPowerUsed += tx.Gas()
e.GasPowerLeft -= tx.Gas()
e.Transactions = append(e.Transactions, txs...)
e.Transactions = append(e.Transactions, tx)
}
}
}
// Spill txs if exceeded size limit
// In all the "real" cases, the event will be limited by gas, not size.
// Yet it's technically possible to construct an event which is limited by size and not by gas.
for uint64(e.CalcSize()) > basic_check.MaxEventSize && len(e.Transactions) > 0 {
for uint64(e.CalcSize()) > (basic_check.MaxEventSize-500) && len(e.Transactions) > 0 {
tx := e.Transactions[len(e.Transactions)-1]
e.GasPowerUsed -= tx.Gas()
e.GasPowerLeft += tx.Gas()
Expand Down

0 comments on commit b350c60

Please sign in to comment.