Skip to content

Commit

Permalink
fix of TestConsensusCallback()
Browse files Browse the repository at this point in the history
  • Loading branch information
rus-alex committed Feb 17, 2024
1 parent d9d5d4f commit 59d028c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions gossip/c_block_callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ func TestConsensusCallback(t *testing.T) {
logger.SetTestMode(t)
require := require.New(t)

const rounds = 30

const validatorsNum = 3
const (
rounds = 30
validatorsNum = 3
)

env := newTestEnv(2, validatorsNum)
defer env.Close()
Expand All @@ -32,11 +33,10 @@ func TestConsensusCallback(t *testing.T) {

for n := uint64(0); n < rounds; n++ {
// transfers
txs := make([]*types.Transaction, validatorsNum)
for i := idx.Validator(0); i < validatorsNum; i++ {
from := i % validatorsNum
to := 0
txs[i] = env.Transfer(idx.ValidatorID(from+1), idx.ValidatorID(to+1), utils.ToFtm(100))
txs := make([]*types.Transaction, 0, validatorsNum-1)
for to, from := 0, 1; from < validatorsNum; from++ {
transfer := env.Transfer(idx.ValidatorID(from+1), idx.ValidatorID(to+1), utils.ToFtm(100))
txs = append(txs, transfer)
}
tm := sameEpoch
if n%10 == 0 {
Expand All @@ -47,7 +47,7 @@ func TestConsensusCallback(t *testing.T) {
// subtract fees
for i, r := range rr {
fee := big.NewInt(0).Mul(new(big.Int).SetUint64(r.GasUsed), txs[i].GasPrice())
balances[i] = big.NewInt(0).Sub(balances[i], fee)
balances[i+1] = big.NewInt(0).Sub(balances[i+1], fee)
}
// balance movements
balances[0].Add(balances[0], utils.ToFtm(200))
Expand Down

0 comments on commit 59d028c

Please sign in to comment.