Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: fix db error #108

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions api/cashu/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ func TestChangeProofsStateToPendingAndQuoteSet(t *testing.T) {
if proofs[0].State != PROOF_PENDING {
t.Errorf("proof transformation not working, should be: %v ", proofs[1].State)
}
if proofs[0].Quote != "123" {
t.Errorf("proof transformation not working, should be: %v ", "123")
res := "123"
if *proofs[0].Quote != res {
t.Errorf("proof transformation not working, should be: %v. is: ", "123")
}
if proofs[1].State != PROOF_PENDING {
t.Errorf("proof transformation not working, should be: %v ", proofs[1].State)

}
if proofs[1].Quote != "123" {
if *proofs[1].Quote != res {
t.Errorf("proof transformation not working, should be: %v ", "123")
}

Expand Down
6 changes: 3 additions & 3 deletions api/cashu/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ type Proofs []Proof
func (p *Proofs) SetPendingAndQuoteRef(quote string) {
for i := 0; i < len(*p); i++ {
(*p)[i].State = PROOF_PENDING
(*p)[i].Quote = quote
(*p)[i].Quote = &quote
}
}

Expand All @@ -165,7 +165,7 @@ func (p *Proofs) SetProofsState(state ProofState) {

func (p *Proofs) SetQuoteReference(quote string) {
for i := 0; i < len(*p); i++ {
(*p)[i].Quote = quote
(*p)[i].Quote = &quote
}
}

Expand All @@ -178,7 +178,7 @@ type Proof struct {
Witness string `json:"witness" db:"witness"`
SeenAt int64 `json:"seen_at"`
State ProofState `json:"state"`
Quote string `json:"quote" db:"quote"`
Quote *string `json:"quote" db:"quote"`
}

func (p Proof) VerifyWitness(spendCondition *SpendCondition, witness *Witness, pubkeysFromProofs *map[*btcec.PublicKey]bool) (bool, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/routes/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func v1MintRoutes(r *gin.Engine, mint *m.Mint, logger *slog.Logger) {

if err != nil {
logger.Error("database.CheckListOfProofs(pool, SecretsList)", slog.String(utils.LogExtraInfo, err.Error()))
c.JSON(400, cashu.ErrorCodeToResponse(cashu.KEYSET_NOT_KNOW, nil))
c.JSON(400, cashu.ErrorCodeToResponse(cashu.UNKNOWN, nil))
return
}

Expand Down
Loading