Invariant checks: Only include not-activated deals
This commit is contained in:
parent
394c3b6deb
commit
65f89ff128
@ -343,6 +343,12 @@ func checkPendingVerifiedDeals(stateTreeV8 *state.StateTree, stateTreeV9 *state.
|
||||
return xerrors.Errorf("failed to get proposals: %w", err)
|
||||
}
|
||||
|
||||
// We only want those pending deals that haven't been activated -- an activated deal has an entry in dealStates8
|
||||
dealStates8, err := adt9.AsArray(actorStore, marketStateV8.States, market8.StatesAmtBitwidth)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to load v8 states array: %w", err)
|
||||
}
|
||||
|
||||
var numPendingVerifiedDeals = 0
|
||||
var proposal market8.DealProposal
|
||||
err = dealProposalsV8.ForEach(&proposal, func(dealID int64) error {
|
||||
@ -366,6 +372,17 @@ func checkPendingVerifiedDeals(stateTreeV8 *state.StateTree, stateTreeV9 *state.
|
||||
return nil
|
||||
}
|
||||
|
||||
var _dealState8 market8.DealState
|
||||
found, err := dealStates8.Get(uint64(dealID), &_dealState8)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to lookup deal state: %w", err)
|
||||
}
|
||||
|
||||
// the deal has an entry in deal states, which means it's already been allocated, nothing to do
|
||||
if found {
|
||||
return nil
|
||||
}
|
||||
|
||||
numPendingVerifiedDeals++
|
||||
// Checks if allocation ID is in market map
|
||||
allocationId, err := marketActorV9.GetAllocationIdForPendingDeal(abi.DealID(dealID))
|
||||
|
Loading…
Reference in New Issue
Block a user