Skip to content

Commit

Permalink
fix: processor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gazenw committed Jun 10, 2024
1 parent 7c23b93 commit cfcfd84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modules/brc20/internal/brc20/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var (
ErrInvalidDec = errors.New("invalid dec")
ErrInvalidSelfMint = errors.New("invalid self_mint")
ErrInvalidAmt = errors.New("invalid amt")
ErrNumberOverflow = errors.New("number overflow: max value is (2^64-1) * 10^18")
ErrNumberOverflow = errors.New("number overflow: max value is (2^64-1)")
)

func ParsePayload(transfer *entity.InscriptionTransfer) (*Payload, error) {
Expand Down Expand Up @@ -94,6 +94,9 @@ func ParsePayload(transfer *entity.InscriptionTransfer) (*Payload, error) {
if p.Dec != nil {
rawDec = *p.Dec
}
if rawDec == "" {
rawDec = "18"
}
dec, ok := strconv.ParseUint(rawDec, 10, 16)
if ok != nil {
return nil, errors.Wrap(ok, "failed to parse dec")
Expand Down
3 changes: 2 additions & 1 deletion modules/brc20/processor_brc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func (p *Processor) processBRC20States(ctx context.Context, transfers []*entity.
}
payload, err := brc20.ParsePayload(transfer)
if err != nil {
return errors.Wrap(err, "failed to parse payload")
// skip invalid payloads
continue
}
payloads = append(payloads, payload)
ticks[payload.Tick] = struct{}{}
Expand Down

0 comments on commit cfcfd84

Please sign in to comment.