Skip to content

Commit

Permalink
Merge pull request #11682 from vegaprotocol/11681-funding-fix
Browse files Browse the repository at this point in the history
fix: handle PK conflicts for funding payments
  • Loading branch information
jeremyletang authored Sep 13, 2024
2 parents 71adf92 + 2a9ed77 commit 3ed0bf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
### 🐛 Fixes

- [11672](https://github.com/vegaprotocol/vega/issues/11672) - Add missing fees in GraphQL bindings.
- [11681](https://github.com/vegaprotocol/vega/issues/11681) - Account for conflicts inserting funding payment records.


## 0.78.2
Expand Down
7 changes: 6 additions & 1 deletion datanode/sqlstore/funding_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ func (fp *FundingPayments) Add(
for _, v := range fundingPayments {
_, err := fp.Exec(ctx,
`insert into funding_payment(market_id, party_id, funding_period_seq, amount, vega_time, tx_hash, loss_socialisation_amount)
values ($1, $2, $3, $4, $5, $6, $7)`,
values ($1, $2, $3, $4, $5, $6, $7)
ON CONFLICT (party_id, market_id, vega_time) DO UPDATE SET
funding_period_seq=EXCLUDED.funding_period_seq,
amount=EXCLUDED.amount,
tx_hash=EXCLUDED.tx_hash,
loss_socialisation_amount=EXCLUDED.loss_socialisation_amount`,
v.MarketID, v.PartyID, v.FundingPeriodSeq, v.Amount, v.VegaTime, v.TxHash, v.LossSocialisationAmount)
if err != nil {
return err
Expand Down

0 comments on commit 3ed0bf2

Please sign in to comment.