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

Test of txs indexing #524

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Loading