algorand / algorand/go-algorand

Provide an option of how many last blocks to store

未关闭
#4,947 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
new-feature-request Team Carbon-11
主要语言
Go
星标
1.4k
派生
537
平均合并
1 天 7 小时
30 天内合并 PR
18

描述

## Problem

Current implementation implies that you can only store last 1000 blocks or run an archive node storing all blocks to the first one.
This is the problem if you need specific amount of last blocks (e.g. 100000 or 10000) and don't want to store all blocks to save space.

## Solution

Provide an option to the algod daemon to specify how many blocks to store.

This should be very easy to fix, I'm not a go lang developer, but I've hard coded to save 10K blocks more by using this patch:

```
diff --git a/ledger/blockqueue.go b/ledger/blockqueue.go
index 4dfa1ae2..45ef5dd8 100644
--- a/ledger/blockqueue.go
+++ b/ledger/blockqueue.go
@@ -143,7 +143,7 @@ func (bq *blockQueue) syncer() {
bq.cond.Broadcast()
bq.mu.Unlock()

- minToSave := bq.l.notifyCommit(committed)
+ minToSave := bq.l.notifyCommit(committed) - 10000
bfstart := time.Now()
ledgerSyncBlockforgetCount.Inc(nil)
err = bq.l.blockDBs.Wdb.Atomic(func(ctx context.Context, tx *sql.Tx) error {
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。