algorand / algorand/go-algorand

Provide an option of how many last blocks to store

Đang mở
#4,947 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
new-feature-request Team Carbon-11
Ngôn ngữ chính
Go
Star
1.4k
Fork
537
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
18

Mô tả

## 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 {
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.