Skip to content

Commit

Permalink
fix panic in RecordContractRenewal
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Dec 16, 2024
1 parent 6008585 commit 987d57c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stores/sql/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ func IsKnownContract(ctx context.Context, tx sql.Tx, fcid types.FileContractID)
}

func RecordContractRenewal(ctx context.Context, tx sql.Tx, oldFCID, newFCID types.FileContractID) error {
_, err := tx.Exec(ctx, "UPDATE contracts SET contracts.renewed_to = ? WHERE contracts.fcid = ?", FileContractID(newFCID), FileContractID(oldFCID))
_, err := tx.Exec(ctx, "UPDATE contracts SET renewed_to = ? WHERE fcid = ?", FileContractID(newFCID), FileContractID(oldFCID))
if err != nil {
return fmt.Errorf("failed to update renewed_to of old contract: %w", err)
}
_, err = tx.Exec(ctx, "UPDATE contracts SET contracts.renewed_from = ? WHERE contracts.fcid = ?", FileContractID(oldFCID), FileContractID(newFCID))
_, err = tx.Exec(ctx, "UPDATE contracts SET renewed_from = ? WHERE fcid = ?", FileContractID(oldFCID), FileContractID(newFCID))
if err != nil {
return fmt.Errorf("failed to update renewed_from of new contract: %w", err)
}
Expand Down

0 comments on commit 987d57c

Please sign in to comment.