Skip to content

Commit 07127ff

Browse files
committed
rename confirmatino to minimal block info
Signed-off-by: Chengxuan Xing <[email protected]>
1 parent 4f65f76 commit 07127ff

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pkg/ffcapi/api.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,33 @@ type API interface {
9797

9898
type ConfirmationMapUpdateResult struct {
9999
*ConfirmationMap
100-
HasNewFork bool `json:"hasNewFork,omitempty"` // when set to true, it means a fork is detected based on the existing confirmations
101-
Rebuilt bool `json:"rebuilt,omitempty"` // when set to true, it means all of the existing confirmations are discarded
102-
HasNewConfirmation bool `json:"hasNewConfirmation,omitempty"` // when set to true, it means new blocks from canonical chain are added to the confirmation queue
103-
Confirmed bool `json:"confirmed,omitempty"` // when set to true, it means the confirmation queue is complete and all the blocks are confirmed
104-
TargetConfirmationCount int `json:"targetConfirmationCount"` // the target number of confirmations for this event
100+
HasNewFork bool `json:"hasNewFork,omitempty"` // when set to true, it means a fork is detected based on the existing confirmations
101+
Rebuilt bool `json:"rebuilt,omitempty"` // when set to true, it means all of the existing confirmations are discarded
102+
HasNewConfirmation bool `json:"hasNewConfirmation,omitempty"` // when set to true, it means new blocks from canonical chain are added to the confirmation queue
103+
Confirmed bool `json:"confirmed,omitempty"` // when set to true, it means the confirmation queue is complete and all the blocks are confirmed
104+
TargetConfirmationCount fftypes.FFuint64 `json:"targetConfirmationCount"` // the target number of confirmations for this event
105105
}
106106

107107
type ConfirmationMap struct {
108108
// confirmation map is contains a list of possible confirmations for a transaction
109109
// the key is the hash of the first block that contains the transaction hash
110110
// the first block is the block that contains the transaction hash
111-
ConfirmationQueueMap map[string][]*Confirmation `json:"confirmationQueueMap,omitempty"`
111+
ConfirmationQueueMap map[string][]*MinimalBlockInfo `json:"confirmationQueueMap,omitempty"`
112112
// which block hash that leads a confirmation queue matches the canonical block hash
113113
CanonicalBlockHash string `json:"canonicalBlockHash,omitempty"`
114114
}
115115

116-
type Confirmation struct { // duplicate of apitypes.Confirmation due to circular dependency
116+
type MinimalBlockInfo struct { // duplicate of apitypes.Confirmation due to circular dependency
117117
BlockNumber fftypes.FFuint64 `json:"blockNumber"`
118118
BlockHash string `json:"blockHash"`
119119
ParentHash string `json:"parentHash"`
120120
}
121121

122-
func (c *Confirmation) Equal(other *Confirmation) bool {
122+
func (c *MinimalBlockInfo) Equal(other *MinimalBlockInfo) bool {
123123
return c.BlockNumber == other.BlockNumber && c.BlockHash == other.BlockHash && c.ParentHash == other.ParentHash
124124
}
125125

126-
func (c *Confirmation) IsParentOf(other *Confirmation) bool {
126+
func (c *MinimalBlockInfo) IsParentOf(other *MinimalBlockInfo) bool {
127127
return c.BlockHash == other.ParentHash && c.BlockNumber+1 == other.BlockNumber
128128
}
129129

pkg/fftm/transaction_management_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ func TestReconcileConfirmationsForTransaction(t *testing.T) {
3535
mFFC := m.connector.(*ffcapimocks.API)
3636

3737
mFFC.On("ReconcileConfirmationsForTransaction", m.ctx, "0x1234567890", &ffcapi.ConfirmationMap{
38-
ConfirmationQueueMap: make(map[string][]*ffcapi.Confirmation),
38+
ConfirmationQueueMap: make(map[string][]*ffcapi.MinimalBlockInfo),
3939
}, 1).Return(&ffcapi.ConfirmationMapUpdateResult{
4040
ConfirmationMap: &ffcapi.ConfirmationMap{
41-
ConfirmationQueueMap: make(map[string][]*ffcapi.Confirmation),
41+
ConfirmationQueueMap: make(map[string][]*ffcapi.MinimalBlockInfo),
4242
},
4343
}, nil)
4444

4545
_, err := m.ReconcileConfirmationsForTransaction(m.ctx, "0x1234567890", &ffcapi.ConfirmationMap{
46-
ConfirmationQueueMap: make(map[string][]*ffcapi.Confirmation),
46+
ConfirmationQueueMap: make(map[string][]*ffcapi.MinimalBlockInfo),
4747
}, 1)
4848
assert.NoError(t, err)
4949
}

0 commit comments

Comments
 (0)