File tree Expand file tree Collapse file tree 1 file changed +13
-21
lines changed
packages/indexer-common/src/indexing-fees Expand file tree Collapse file tree 1 file changed +13
-21
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,7 @@ export class DipsManager {
97
97
} ,
98
98
} )
99
99
for ( const agreement of outstandingAgreements ) {
100
- if ( agreement . last_allocation_id ) {
101
- await this . tryCollectPayment ( agreement )
102
- } else {
103
- // This should never happen as we check for this in the query
104
- this . logger . error ( `Agreement ${ agreement . id } has no last allocation id` )
105
- }
100
+ await this . tryCollectPayment ( agreement )
106
101
}
107
102
}
108
103
async tryCollectPayment ( agreement : IndexingAgreement ) {
@@ -145,28 +140,25 @@ export class DipsManager {
145
140
)
146
141
}
147
142
await this . network . queryFeeModels . scalarTapReceipts . create ( tapReceipt )
143
+ // Mark the agreement as having had a payment collected
144
+ await this . models . IndexingAgreement . update (
145
+ {
146
+ last_payment_collected_at : new Date ( ) ,
147
+ } ,
148
+ {
149
+ where : {
150
+ id : agreement . id ,
151
+ } ,
152
+ } ,
153
+ )
148
154
} else {
149
- this . logger . error ( `Error collecting payment for agreement ${ agreement . id } ` , {
150
- error : response . status ,
151
- } )
155
+ throw new Error ( `Payment request not accepted: ${ response . status } ` )
152
156
}
153
157
} catch ( error ) {
154
158
this . logger . error ( `Error collecting payment for agreement ${ agreement . id } ` , {
155
159
error,
156
160
} )
157
161
}
158
-
159
- // Mark the agreement as having had a payment collected
160
- await this . models . IndexingAgreement . update (
161
- {
162
- last_payment_collected_at : new Date ( ) ,
163
- } ,
164
- {
165
- where : {
166
- id : agreement . id ,
167
- } ,
168
- } ,
169
- )
170
162
}
171
163
async ensureAgreementRules ( ) {
172
164
if ( ! this . parent ) {
You can’t perform that action at this time.
0 commit comments