feat: add nonce bootstrapper

Useful for rebuilding the nonce cache automatically.

* uses otx_sign as the first source
* can fallback to chain nonce value of the 1st source is corrupted
This commit is contained in:
2023-04-13 10:38:23 +00:00
parent b137088d38
commit 0e5db7f06f
7 changed files with 89 additions and 26 deletions

View File

@@ -110,9 +110,11 @@ func initCommonRedisPool() *redis.RedisPool {
}
// Load redis backed noncestore.
func initRedisNoncestore(redisPool *redis.RedisPool) nonce.Noncestore {
func initRedisNoncestore(redisPool *redis.RedisPool, chainProvider *celoutils.Provider, store store.Store) nonce.Noncestore {
return nonce.NewRedisNoncestore(nonce.Opts{
RedisPool: redisPool,
ChainProvider: chainProvider,
RedisPool: redisPool,
Store: store,
})
}

View File

@@ -51,7 +51,7 @@ func main() {
redisPool := initCommonRedisPool()
store := initPgStore()
redisNoncestore := initRedisNoncestore(redisPool)
redisNoncestore := initRedisNoncestore(redisPool, celoProvider, store)
lockProvider := initLockProvider(redisPool.Client)
taskerClient := initTaskerClient(asynqRedisPool)