Skip to content

Commit

Permalink
A
Browse files Browse the repository at this point in the history
  • Loading branch information
xxo1shine committed Dec 15, 2021
1 parent d50388e commit 32898d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"runtime/debug"
"sync"
"time"
"unsafe"

cfg "github.com/tendermint/tendermint/config"
cstypes "github.com/tendermint/tendermint/consensus/types"
Expand Down Expand Up @@ -1489,10 +1490,12 @@ func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p
}
if added && cs.ProposalBlockParts.IsComplete() {
// Added and completed!
size := len(cs.state.SideTxResponses)
maxSize := cs.state.ConsensusParams.Block.MaxBytes + int64(size) * 223 * int64(cs.state.Validators.Size())
_, err = cdc.UnmarshalBinaryLengthPrefixedReader(
cs.ProposalBlockParts.GetReader(),
&cs.ProposalBlock,
cs.state.ConsensusParams.Block.MaxBytes,
maxSize,
)
if err != nil {
cs.Logger.Error("### Generate block failed.", "H", cs.Height, "maxByte", cs.state.ConsensusParams.Block.MaxBytes, "err", err)
Expand Down Expand Up @@ -1744,6 +1747,11 @@ func (cs *ConsensusState) signVote(type_ types.SignedMsgType, hash []byte, heade
}
}
sideTxResults = append(sideTxResults, sideTxResponse.SideTxResult)
cs.Logger.Info("@@@ signVote",
"hashLen", len(sideTxResponse.SideTxResult.TxHash),
"SigLen", len(sideTxResponse.SideTxResult.Sig),
"Result", unsafe.Sizeof(sideTxResponse.SideTxResult.Result),
"total", unsafe.Sizeof(sideTxResponse.SideTxResult))
}
vote.SideTxResults = sideTxResults
}
Expand Down
2 changes: 0 additions & 2 deletions state/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
evidence := blockExec.evpool.PendingEvidence(maxNumEvidence)

// Fetch a limited amount of valid txs
size := len(state.SideTxResponses)
maxBytes = maxBytes - int64(size) * 223 * int64(state.Validators.Size())
maxDataBytes := types.MaxDataBytes(maxBytes, state.Validators.Size(), len(evidence))
txs := blockExec.mempool.ReapMaxBytesMaxGas(maxDataBytes, maxGas)

Expand Down

0 comments on commit 32898d7

Please sign in to comment.