Skip to content

Commit

Permalink
Check confirmations for submitted unmixed utxo inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Sep 1, 2023
1 parent ea898fb commit 3500550
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion coinjoin/coinjoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ func verifyOutput(c Caller, outpoint *wire.OutPoint, value int64) error {
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
defer cancel()
var res struct {
Value float64 `json:"value"`
Value float64 `json:"value"`
Confirmations int64 `json:"confirmations"`
}
err := c.Call(ctx, "gettxout", &res, outpoint.Hash.String(), outpoint.Index, outpoint.Tree)
if err != nil {
Expand All @@ -323,6 +324,12 @@ func verifyOutput(c Caller, outpoint *wire.OutPoint, value int64) error {
nil,
}
}
if res.Confirmations <= 0 {
return &blameError{
fmt.Sprintf("output %v has not been confirmed", outpoint),
nil,
}
}
return nil
}

Expand Down

0 comments on commit 3500550

Please sign in to comment.