Browse Source

Rm dvote/censustree interface dependency (which nolonger exists)

master
arnaucube 2 years ago
parent
commit
f55bf85ccc
3 changed files with 346 additions and 20 deletions
  1. +3
    -7
      asmt.go
  2. +4
    -4
      go.mod
  3. +339
    -9
      go.sum

+ 3
- 7
asmt.go

@ -7,7 +7,6 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"go.vocdoni.io/dvote/censustree"
"go.vocdoni.io/dvote/log" "go.vocdoni.io/dvote/log"
"go.vocdoni.io/proto/build/go/models" "go.vocdoni.io/proto/build/go/models"
@ -32,9 +31,6 @@ type Tree struct {
snapshotSize uint64 snapshotSize uint64
} }
// check that censustree.Tree interface is matched by Tree
var _ censustree.Tree = (*Tree)(nil)
type Proof struct { type Proof struct {
Bitmap []byte Bitmap []byte
Length int Length int
@ -57,8 +53,8 @@ const (
dbRootPrefix = "this is the last root for the SMT tree" dbRootPrefix = "this is the last root for the SMT tree"
) )
// NewTree initializes a new AergoSMT tree following the censustree.Tree interface specification.
func NewTree(name, storageDir string) (censustree.Tree, error) {
// NewTree initializes a new AergoSMT tree following the Tree interface specification.
func NewTree(name, storageDir string) (*Tree, error) {
tr := &Tree{} tr := &Tree{}
err := tr.Init(name, storageDir) err := tr.Init(name, storageDir)
return tr, err return tr, err
@ -371,7 +367,7 @@ func (t *Tree) ImportDump(data []byte) error {
// Snapshot returns a Tree instance of a exiting merkle root. // Snapshot returns a Tree instance of a exiting merkle root.
// A Snapshot cannot be modified. // A Snapshot cannot be modified.
func (t *Tree) Snapshot(root []byte) (censustree.Tree, error) {
func (t *Tree) Snapshot(root []byte) (*Tree, error) {
exist, err := t.HashExists(root) exist, err := t.HashExists(root)
if err != nil { if err != nil {
return nil, err return nil, err

+ 4
- 4
go.mod

@ -7,8 +7,8 @@ require (
github.com/aergoio/aergo-lib v1.0.2 github.com/aergoio/aergo-lib v1.0.2
github.com/guptarohit/asciigraph v0.4.1 github.com/guptarohit/asciigraph v0.4.1
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca
go.vocdoni.io/dvote v1.0.4-0.20210809075252-5e1716d5e0f5
go.vocdoni.io/proto v1.0.4-0.20210726091234-bceaf416353b
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
go.vocdoni.io/dvote v1.0.4-0.20211224171421-4172e1643820
go.vocdoni.io/proto v1.13.3-0.20211213155005-46b4177904ba
golang.org/x/crypto v0.0.0-20210920023735-84f357641f63
) )

+ 339
- 9
go.sum
File diff suppressed because it is too large
View File


Loading…
Cancel
Save