This helps for some reason
This commit is contained in:
parent
9ad4a00cda
commit
5810922441
@ -195,6 +195,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, blks []*types.Bl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if applied[m.From] != m.Nonce {
|
if applied[m.From] != m.Nonce {
|
||||||
|
log.Infof("skipping message from %s: nonce check failed: exp %d, was %d", m.From, applied[m.From], m.Nonce)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
applied[m.From]++
|
applied[m.From]++
|
||||||
|
@ -2,6 +2,7 @@ package miner
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -348,16 +349,26 @@ func (m *Miner) actorLookup(ctx context.Context, addr address.Address, ts *types
|
|||||||
|
|
||||||
balance := act.Balance
|
balance := act.Balance
|
||||||
curnonce := act.Nonce
|
curnonce := act.Nonce
|
||||||
|
|
||||||
|
sort.Slice(msgs, func(i, j int) bool { // TODO: is this actually needed?
|
||||||
|
return msgs[i].Message.Nonce < msgs[j].Message.Nonce
|
||||||
|
})
|
||||||
|
|
||||||
|
max := int64(-2)
|
||||||
|
|
||||||
for _, m := range msgs {
|
for _, m := range msgs {
|
||||||
if m.Message.From == addr {
|
if m.Message.From == addr {
|
||||||
if m.Message.Nonce != curnonce {
|
max = int64(m.Message.Nonce)
|
||||||
return 0, nil, xerrors.Errorf("tipset messages had bad nonce: %s had nonce %d, expected %d", m.Cid, m.Message.Nonce, curnonce)
|
|
||||||
}
|
|
||||||
curnonce++
|
|
||||||
balance = types.BigSub(balance, m.Message.RequiredFunds())
|
balance = types.BigSub(balance, m.Message.RequiredFunds())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
max++ // next unapplied nonce
|
||||||
|
|
||||||
|
if max != -1 && uint64(max) != curnonce {
|
||||||
|
return 0, nil, xerrors.Errorf("tipset messages from %s have too low nonce %d, expected %d, h: %d", addr, max, curnonce, ts.Height())
|
||||||
|
}
|
||||||
|
|
||||||
return curnonce, &balance, nil
|
return curnonce, &balance, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user