diff --git a/db/db.go b/db/db.go index e289f91..5efe0db 100644 --- a/db/db.go +++ b/db/db.go @@ -173,6 +173,7 @@ func UnpackGenericValue(key, value []byte) (byte, interface{}, error) { func NewIterateOptions() *IterOptions { return &IterOptions{ FillCache: false, + Prefix: []byte{}, Start: nil, Stop: nil, IncludeStart: true, @@ -189,6 +190,11 @@ func (o *IterOptions) WithFillCache(fillCache bool) *IterOptions { return o } +func (o *IterOptions) WithPrefix(prefix []byte) *IterOptions { + o.Prefix = prefix + return o +} + func (o *IterOptions) WithStart(start []byte) *IterOptions { o.Start = start return o @@ -219,6 +225,16 @@ func (o *IterOptions) WithIncludeValue(includeValue bool) *IterOptions { return o } +func (o *IterOptions) WithRawKey(rawKey bool) *IterOptions { + o.RawKey = rawKey + return o +} + +func (o *IterOptions) WithRawValue(rawValue bool) *IterOptions { + o.RawValue = rawValue + return o +} + func (k *UTXOKey) String() string { return fmt.Sprintf( "%s(hashX=%s, tx_num=%d, nout=%d)", diff --git a/db/prefixes/prefixes.go b/db/prefixes/prefixes.go index ff9fb76..922aee4 100644 --- a/db/prefixes/prefixes.go +++ b/db/prefixes/prefixes.go @@ -1,45 +1,6 @@ package prefixes const ( - - //ClaimToSupport = []byte("K") - //SupportToClaim = []byte("L") - // - //ClaimToTXO = []byte("E") - //TXOToClaim = []byte("G") - // - //ClaimToChannel = []byte("I") - //ChannelToClaim = []byte("J") - // - //ClaimShortIdPrefix = []byte("F") - //EffectiveAmount = []byte("D") - //ClaimExpiration = []byte("O") - // - //ClaimTakeover = []byte("P") - //PendingActivation = []byte("Q") - //ActivatedClaimAndSupport = []byte("R") - //ActiveAmount = []byte("S") - // - //Repost = []byte("V") - //RepostedClaim = []byte("W") - // - //Undo = []byte("M") - //ClaimDiff = []byte("Y") - // - //Tx = []byte("B") - //BlockHash = []byte("C") - //Header = []byte("H") - //TxNum = []byte("N") - //TxCount = []byte("T") - //TxHash = []byte("X") - //UTXO = []byte("u") - //HashXUTXO = []byte("h") - //HashXHistory = []byte("x") - //DBState = []byte("s") - //ChannelCount = []byte("Z") - //SupportAmount = []byte("a") - //BlockTXs = []byte("b") - ClaimToSupport = 'K' SupportToClaim = 'L' @@ -53,10 +14,10 @@ const ( EffectiveAmount = 'D' ClaimExpiration = 'O' + ActiveAmount = 'S' ClaimTakeover = 'P' PendingActivation = 'Q' ActivatedClaimAndSupport = 'R' - ActiveAmount = 'S' Repost = 'V' RepostedClaim = 'W'