Skip to content

Commit

Permalink
Merge pull request #7 from gobicycle/develop
Browse files Browse the repository at this point in the history
allowable time lag in env variable
  • Loading branch information
gobicycle authored Jun 21, 2023
2 parents a58a241 + f5e3a92 commit f4ec2a0
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ For more information on Jettons compatibility, see [Jettons compatibility](/jett
| `QUEUE_NAME` | name of exchange |
| `WEBHOOK_ENDPOINT` | endpoint to send webhooks, example: `http://hostname:3333/webhook`. If the value is not set, then webhooks are not sent. |
| `WEBHOOK_TOKEN` | Bearer token for webhook request. If not set then not used. |
| `ALLOWABLE_LAG` | allowable time lag between service time and last block time in seconds, default: 15 |

**! Be careful with `IS_TESTNET` variable.** This does not guarantee that a testnet node is being used. It is only for address checking purposes.

Expand Down
7 changes: 6 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
InternalWithdrawalPeriod = 30 * time.Second
ExpirationProcessorPeriod = 5 * time.Second

AllowableBlockchainLagging = 15 * time.Second
AllowableBlockchainLagging = 15 * time.Second // TODO: use env var
AllowableServiceToNodeTimeDiff = 2 * time.Second
)

Expand Down Expand Up @@ -51,6 +51,7 @@ var Config = struct {
QueueEnabled bool `env:"QUEUE_ENABLED" envDefault:"false"`
WebhookEndpoint string `env:"WEBHOOK_ENDPOINT"`
WebhookToken string `env:"WEBHOOK_TOKEN"`
AllowableLaggingSec int `env:"ALLOWABLE_LAG"`
Jettons map[string]Jetton
Ton Cutoffs
ColdWallet *address.Address
Expand Down Expand Up @@ -104,6 +105,10 @@ func GetConfig() {
}
Config.BlockchainConfig = config[0]
}

if Config.AllowableLaggingSec != 0 {
AllowableBlockchainLagging = time.Second * time.Duration(Config.AllowableLaggingSec)
}
}

func parseJettonString(s string) map[string]Jetton {
Expand Down
Loading

0 comments on commit f4ec2a0

Please sign in to comment.