Skip to content
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/library/golang:1.23-bookworm AS builder
FROM docker.io/library/golang:1.24-bookworm AS builder
WORKDIR /build-dir
COPY go.mod .
COPY go.sum .
Expand Down
11 changes: 6 additions & 5 deletions core/withdrawal_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package core
import (
"context"
"fmt"
"math/big"
"sync"
"sync/atomic"
"time"

"github.com/gobicycle/bicycle/audit"
"github.com/gobicycle/bicycle/config"
"github.com/gofrs/uuid"
log "github.com/sirupsen/logrus"
"github.com/xssnick/tonutils-go/address"
"github.com/xssnick/tonutils-go/tlb"
"github.com/xssnick/tonutils-go/ton/wallet"
"math/big"
"sync"
"sync/atomic"
"time"
)

type WithdrawalsProcessor struct {
Expand Down Expand Up @@ -81,7 +82,7 @@ func (p *WithdrawalsProcessor) startWithdrawalsProcessor() {
break
}
time.Sleep(config.ExternalWithdrawalPeriod)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*25) // must be < ExternalWithdrawalPeriod
ctx, cancel := context.WithTimeout(context.Background(), time.Second*50) // must be < ExternalWithdrawalPeriod
err := p.makeColdWalletWithdrawals(ctx)
if err != nil {
log.Fatalf("make withdrawals to cold wallet error: %v\n", err)
Expand Down
14 changes: 8 additions & 6 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,13 +786,15 @@ func (c *Connection) GetJettonInternalWithdrawalTasks(
SELECT deposit_address, MAX(lt) AS last_lt, jw.subwallet_id, jw.currency
FROM payments.external_incomes di
LEFT JOIN (
SELECT from_address, since_lt, finish_lt
SELECT iw1.from_address, iw1.since_lt, iw1.finish_lt
FROM payments.internal_withdrawals iw1
WHERE since_lt = (
SELECT MAX(iw2.since_lt)
FROM payments.internal_withdrawals iw2
WHERE iw2.from_address = iw1.from_address AND failed = false
)
JOIN (
SELECT from_address, MAX(since_lt) AS max_since_lt
FROM payments.internal_withdrawals
WHERE failed = false
GROUP BY from_address
) iw2 ON iw2.from_address = iw1.from_address AND iw2.max_since_lt = iw1.since_lt
WHERE iw1.failed = false
) as iw3 ON from_address = deposit_address
JOIN payments.jetton_wallets jw ON di.deposit_address = jw.address
LEFT JOIN payments.ton_wallets tw ON jw.subwallet_id = tw.subwallet_id
Expand Down
3 changes: 0 additions & 3 deletions deploy/db/01_init.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ CREATE INDEX IF NOT EXISTS internal_withdrawals_since_lt_index
CREATE INDEX IF NOT EXISTS internal_withdrawals_expired_at_index
ON payments.internal_withdrawals (expired_at);

CREATE INDEX IF NOT EXISTS internal_withdrawals_failed_from_address_index
ON payments.internal_withdrawals (failed, from_address);

CREATE TABLE IF NOT EXISTS payments.service_withdrawal_requests
(
memo uuid not null default gen_random_uuid() unique,
Expand Down
2 changes: 0 additions & 2 deletions deploy/manual_migrations/0.5.x-0.6.3.sql

This file was deleted.

10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/gobicycle/bicycle

go 1.23.0
go 1.24.0

toolchain go1.23.10
toolchain go1.24.11

require (
github.com/caarlos0/env/v6 v6.10.1
Expand Down Expand Up @@ -34,9 +34,9 @@ require (
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect
github.com/snksoft/crc v1.1.0 // indirect
golang.org/x/crypto v0.38.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp v0.0.0-20230116083435-1de6713980de // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.25.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
golang.org/x/exp v0.0.0-20230116083435-1de6713980de h1:DBWn//IJw30uYCgERoxCg84hWtA97F4wMiKOIh00Uf0=
golang.org/x/exp v0.0.0-20230116083435-1de6713980de/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand All @@ -185,17 +185,17 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
4 changes: 0 additions & 4 deletions manual_migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ will be filled with a 0 workchain.
2. Build new docker image and recreate container for `payment-processor` as described in `Service deploy` chapter in [Readme](/README.md)

Note that this query creates a new nullable column in the `external_withdrawals` and `external_incomes` DB tables and `binary_comment` column in `withdrawal_requests` table.

## v0.5.x -> v0.6.3
1. Apply [DB migration](/deploy/manual_migrations/0.5.x-0.6.3.sql)
2. Build new docker image and recreate container for `payment-processor` as described in `Service deploy` chapter in [Readme](/README.md)
Loading