mirror of
https://github.com/arnaucube/go-merkletree-iden3.git
synced 2026-02-07 03:26:46 +01:00
Small fixes
This commit is contained in:
@@ -64,7 +64,7 @@ func NewSqlStorage(db *sqlx.DB, errorIfMissing bool) (*Storage, error) {
|
||||
func (s *Storage) WithPrefix(prefix []byte) merkletree.Storage {
|
||||
//return &Storage{db: s.db, prefix: merkletree.Concat(s.prefix, prefix)}
|
||||
// TODO: remove WithPrefix method
|
||||
mtId := s.mtId<<4 | binary.LittleEndian.Uint64(prefix)
|
||||
mtId, _ := binary.Uvarint(prefix)
|
||||
return &Storage{db: s.db, mtId: mtId}
|
||||
}
|
||||
|
||||
@@ -252,6 +252,9 @@ func (tx *StorageTx) Commit() error {
|
||||
}
|
||||
}
|
||||
|
||||
if tx.currentRoot == nil {
|
||||
tx.currentRoot = &merkletree.Hash{}
|
||||
}
|
||||
_, err := tx.tx.Exec(updateRootStmt, tx.mtId, tx.currentRoot[:])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user