Optionally pass root through (#183)

This commit is contained in:
Jaco Greeff
2018-07-30 10:46:19 +02:00
committed by GitHub
parent 25599fefe7
commit 07522512b3
3 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -41,8 +41,7 @@ export default class BaseTrie {
putRaw: RawPutFn;
semaphore: SemaphorePromise;
// @ts-ignore FIXME, we need to properly check the full file
constructor (db, root: Uint8Array, hashing: HashFn) {
constructor (db: any, root: Uint8Array, hashing: HashFn) {
this.putRaw = this._putRaw;
this.semaphore = semaphore(1);
+1 -1
View File
@@ -36,7 +36,7 @@ export default class CheckpointTrie extends BaseTrie {
__putDBs: any[]; // tslint:disable-line
// @ts-ignore FIXME, we need to properly check the full file
constructor (db, root: Uint8Array, hashing: HashFn) {
constructor (db: any, root: Uint8Array, hashing: HashFn) {
super(db, root, hashing);
this._scratch = null;
+2 -2
View File
@@ -9,6 +9,7 @@ import { HashFn } from './types';
import keccakAsU8a from '@polkadot/util-crypto/keccak/asU8a';
import CheckpointTrie from './CheckpointTrie';
import { EMPTY_ROOT_U8A } from './constants';
import { prove, verifyProof } from './proof';
// const l = logger('trie');
@@ -17,8 +18,7 @@ export default class Trie extends CheckpointTrie {
static prove = prove;
static verifyProof = verifyProof;
// @ts-ignore FIXME, we need to properly check the full file
constructor (db, root, hashing: HashFn = keccakAsU8a) {
constructor (db: any, root: Uint8Array = EMPTY_ROOT_U8A, hashing: HashFn = keccakAsU8a) {
super(db, root, hashing);
// l.debug('Created Trie');