Skip to content

Commit 7bc7bb8

Browse files
committed
rename the confirmation to minimal block info
Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
1 parent 4f65f76 commit 7bc7bb8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/ffcapi/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ 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)