Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit acc8365

Browse files
authored
- Added whiteFlagIndex to block metadata response (#394)
1 parent 7b53090 commit acc8365

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

nodeclient/core_models.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,19 @@ type (
9494
// Whether the block is solid.
9595
Solid bool `json:"isSolid"`
9696
// The milestone index that references this block.
97-
ReferencedByMilestoneIndex *iotago.MilestoneIndex `json:"referencedByMilestoneIndex,omitempty"`
97+
ReferencedByMilestoneIndex iotago.MilestoneIndex `json:"referencedByMilestoneIndex,omitempty"`
9898
// If this block represents a milestone this is the milestone index
99-
MilestoneIndex *iotago.MilestoneIndex `json:"milestoneIndex,omitempty"`
99+
MilestoneIndex iotago.MilestoneIndex `json:"milestoneIndex,omitempty"`
100100
// The ledger inclusion state of the transaction payload.
101-
LedgerInclusionState *string `json:"ledgerInclusionState,omitempty"`
101+
LedgerInclusionState string `json:"ledgerInclusionState,omitempty"`
102102
// Whether the block should be promoted.
103103
ShouldPromote *bool `json:"shouldPromote,omitempty"`
104104
// Whether the block should be reattached.
105105
ShouldReattach *bool `json:"shouldReattach,omitempty"`
106106
// The reason why this block is marked as conflicting.
107107
ConflictReason uint8 `json:"conflictReason,omitempty"`
108+
// If this block is referenced by a milestone this returns the index of that block inside the milestone by whiteflag ordering.
109+
WhiteFlagIndex *uint32 `json:"whiteFlagIndex,omitempty"`
108110
}
109111

110112
// ChildrenResponse defines the response of a GET children REST API call.

nodeclient/http_api_client_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,19 @@ func TestClient_BlockMetadataByMessageID(t *testing.T) {
181181
parentBlockIDs[i] = iotago.EncodeHex(p[:])
182182
}
183183

184+
wfIndex := uint32(5)
185+
184186
originRes := &nodeclient.BlockMetadataResponse{
185187
BlockID: queryHash,
186188
Parents: parentBlockIDs,
187189
Solid: true,
188-
MilestoneIndex: nil,
189-
ReferencedByMilestoneIndex: nil,
190-
LedgerInclusionState: nil,
190+
MilestoneIndex: 66,
191+
ReferencedByMilestoneIndex: 67,
192+
LedgerInclusionState: "noTransaction",
191193
ShouldPromote: nil,
192194
ShouldReattach: nil,
193195
ConflictReason: 0,
196+
WhiteFlagIndex: &wfIndex,
194197
}
195198

196199
gock.New(nodeAPIUrl).

0 commit comments

Comments
 (0)