@@ -133,12 +133,6 @@ const cidGravityMinerCheckUrl = "https://service.cidgravity.com/private/v1/miner
133
133
const cidGravityMinerCheckLabel = "cidg-miner-status-check"
134
134
const agentName = "curio"
135
135
136
- var commonHeaders = http.Header {
137
- "X-CIDgravity-Agent" : []string {"CIDgravity-storage-Connector" },
138
- "X-CIDgravity-Version" : []string {"1.0" },
139
- "Content-Type" : []string {"application/json" },
140
- }
141
-
142
136
func (m * MK12 ) cidGravityCheck (ctx context.Context , deal * ProviderDealState ) (bool , string , error ) {
143
137
144
138
data , err := m .prepareCidGravityPayload (ctx , deal )
@@ -150,7 +144,11 @@ func (m *MK12) cidGravityCheck(ctx context.Context, deal *ProviderDealState) (bo
150
144
client := & http.Client {}
151
145
152
146
// Create the new request
153
- var req * http.Request
147
+ req , err := http .NewRequest ("POST" , cidGravityDealCheckUrl , bytes .NewBuffer (data ))
148
+ if err != nil {
149
+ return false , "" , xerrors .Errorf ("Error creating request: %w" , err )
150
+ }
151
+
154
152
if deal .ClientDealProposal .Proposal .Label .IsString () {
155
153
lableStr , err := deal .ClientDealProposal .Proposal .Label .ToString ()
156
154
if err != nil {
@@ -162,15 +160,15 @@ func (m *MK12) cidGravityCheck(ctx context.Context, deal *ProviderDealState) (bo
162
160
return false , "" , xerrors .Errorf ("Error creating request: %w" , err )
163
161
}
164
162
}
165
- } else {
166
- req , err = http .NewRequest ("POST" , cidGravityDealCheckUrl , bytes .NewBuffer (data ))
167
- if err != nil {
168
- return false , "" , xerrors .Errorf ("Error creating request: %w" , err )
169
- }
170
163
}
171
164
172
165
// Add necessary headers
173
- req .Header = commonHeaders
166
+ req .Header = http.Header {
167
+ "X-CIDgravity-Agent" : []string {"CIDgravity-storage-Connector" },
168
+ "X-CIDgravity-Version" : []string {"1.0" },
169
+ "Content-Type" : []string {"application/json" },
170
+ }
171
+
174
172
req .Header .Set ("X-API-KEY" , m .cfg .Market .StorageMarketConfig .MK12 .CIDGravityToken )
175
173
req .Header .Set ("X-Address-ID" , deal .ClientDealProposal .Proposal .Provider .String ())
176
174
req .Header .Set ("Authorization" , m .cfg .Market .StorageMarketConfig .MK12 .CIDGravityToken )
0 commit comments