Skip to content

Commit

Permalink
Merge pull request #212 from bitcoin-sv/fix-db-query
Browse files Browse the repository at this point in the history
fix syntax in query
  • Loading branch information
boecklim authored Dec 14, 2023
2 parents 30e8542 + b51321f commit cf562c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion metamorph/callbacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func SendCallback(logger *slog.Logger, s store.MetamorphStore, tx *store.StoreDa
err = s.RemoveCallbacker(context.Background(), tx.Hash)
if err != nil {
logger.Error("Couldn't update/remove callback url - ", err)
continue
return
}
return
}
Expand Down
9 changes: 5 additions & 4 deletions metamorph/store/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
rejectReasonAttributeKey = ":reject_reason"
announcedAtAttributeKey = ":announced_at"
minedAtAttributeKey = ":mined_at"
callbackUrl = ":callback_url"
)

type DynamoDB struct {
Expand Down Expand Up @@ -518,15 +519,15 @@ func (ddb *DynamoDB) RemoveCallbacker(ctx context.Context, hash *chainhash.Hash)
span, _ := opentracing.StartSpanFromContext(ctx, "sql:RemoveCallbacker")
defer span.Finish()

updateExpression := "SET callback_url = ''"

// update tx
_, err := ddb.client.UpdateItem(ctx, &dynamodb.UpdateItemInput{
TableName: aws.String(ddb.transactionsTableName),
Key: map[string]types.AttributeValue{
"tx_hash": &types.AttributeValueMemberB{Value: hash.CloneBytes()},
},
UpdateExpression: aws.String(updateExpression),
UpdateExpression: aws.String("SET callback_url = :callback_url"),
ExpressionAttributeValues: map[string]types.AttributeValue{
callbackUrl: &types.AttributeValueMemberS{Value: ""},
},
})

if err != nil {
Expand Down

0 comments on commit cf562c8

Please sign in to comment.