drop balance checks in block validation
This commit is contained in:
parent
2228f13f99
commit
9e67bef4bd
@ -5,10 +5,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/minio/blake2b-simd"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/minio/blake2b-simd"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
@ -779,7 +780,6 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
nonces := make(map[address.Address]uint64)
|
nonces := make(map[address.Address]uint64)
|
||||||
balances := make(map[address.Address]types.BigInt)
|
|
||||||
|
|
||||||
stateroot, _, err := syncer.sm.TipSetState(ctx, baseTs)
|
stateroot, _, err := syncer.sm.TipSetState(ctx, baseTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -804,7 +804,6 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
|
|||||||
return xerrors.Errorf("failed to get actor: %w", err)
|
return xerrors.Errorf("failed to get actor: %w", err)
|
||||||
}
|
}
|
||||||
nonces[m.From] = act.Nonce
|
nonces[m.From] = act.Nonce
|
||||||
balances[m.From] = act.Balance
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if nonces[m.From] != m.Nonce {
|
if nonces[m.From] != m.Nonce {
|
||||||
@ -812,11 +811,6 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
|
|||||||
}
|
}
|
||||||
nonces[m.From]++
|
nonces[m.From]++
|
||||||
|
|
||||||
if balances[m.From].LessThan(m.RequiredFunds()) {
|
|
||||||
return xerrors.Errorf("not enough funds for message execution")
|
|
||||||
}
|
|
||||||
|
|
||||||
balances[m.From] = types.BigSub(balances[m.From], m.RequiredFunds())
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user