github.com/koko1123/flow-go-1@v0.29.6/cmd/util/ledger/migrations/prune_migration.go (about)

     1  package migrations
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/ledger"
     5  )
     6  
     7  // PruneMigration removes all the payloads with empty value
     8  // this prunes the trie for values that has been deleted
     9  func PruneMigration(payload []ledger.Payload) ([]ledger.Payload, error) {
    10  	newPayload := make([]ledger.Payload, 0, len(payload))
    11  	for _, p := range payload {
    12  		if len(p.Value()) > 0 {
    13  			newPayload = append(newPayload, p)
    14  		}
    15  	}
    16  	return newPayload, nil
    17  }