-
Notifications
You must be signed in to change notification settings - Fork 178
/
pending_receipts.go
30 lines (25 loc) · 1.22 KB
/
pending_receipts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package mempool
import "github.com/onflow/flow-go/model/flow"
// PendingReceipts stores pending receipts indexed by the id.
// It also maintains a secondary index on the previous result id, which is unique,
// in order to allow to find a receipt by the previous result id.
type PendingReceipts interface {
// Add a pending receipt
// return true if added
// return false if is a duplication
Add(receipt *flow.ExecutionReceipt) bool
// Remove a pending receipt by ID
Remove(receiptID flow.Identifier) bool
// ByPreviousResultID returns all the pending receipts whose previous result id
// matches the given result id
ByPreviousResultID(previousReusltID flow.Identifier) []*flow.ExecutionReceipt
// PruneUpToHeight remove all receipts for blocks whose height is strictly
// smaller that height. Note: receipts for blocks at height are retained.
// After pruning, receipts below for blocks below the given height are dropped.
//
// Monotonicity Requirement:
// The pruned height cannot decrease, as we cannot recover already pruned elements.
// If `height` is smaller than the previous value, the previous value is kept
// and the sentinel mempool.BelowPrunedThresholdError is returned.
PruneUpToHeight(height uint64) error
}