-
Notifications
You must be signed in to change notification settings - Fork 14
/
pending.go
39 lines (34 loc) · 1002 Bytes
/
pending.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
31
32
33
34
35
36
37
38
39
package chain
import (
"github.com/eosspark/eos-go/chain/types"
"github.com/eosspark/eos-go/common"
"github.com/eosspark/eos-go/database"
)
type PendingState struct {
//MaybeSession *database.Session `json:"db_session"`
DbSession *MaybeSession `json:"db_session"`
PendingBlockState *types.BlockState `json:"pending_block_state"`
Actions []types.ActionReceipt `json:"actions"`
BlockStatus types.BlockStatus `json:"block_status"`
ProducerBlockId common.BlockIdType
PendingValid bool
}
func NewPendingState(db database.DataBase) *PendingState {
pending := PendingState{}
pending.DbSession = NewMaybeSession(db)
pending.BlockStatus = types.Incomplete
pending.PendingValid = false
return &pending
}
func NewDefaultPendingState() *PendingState {
return &PendingState{}
}
func (p *PendingState) Reset() *PendingState {
p.DbSession.Undo()
return nil
}
func (p *PendingState) Push() {
if p.DbSession != nil {
p.DbSession.Push()
}
}