How to use the merkle-patricia-tree/secure.verifyProof function in merkle-patricia-tree

To help you get started, we’ve selected a few merkle-patricia-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereumjs / ethereumjs-vm / lib / stateless.ts View on Github external
import { promisify } from 'util'
import * as assert from 'assert'
import * as ethUtil from 'ethereumjs-util'
import Account from 'ethereumjs-account'
import VM from './index'
import { default as StateManager, StateManagerOpts } from './state/stateManager'
import runTx from './runTx'

const SecureTrie = require('merkle-patricia-tree/secure')
const verifyProof = promisify(SecureTrie.verifyProof)

export class HookedStateManager extends StateManager {
  seenKeys: Set
  origState: StateManager
  proofNodes: Map

  constructor(opts: StateManagerOpts) {
    super(opts)
    this.seenKeys = new Set()
    this.origState = new StateManager()
    this.proofNodes = new Map()
  }

  getAccount(addr: Buffer, cb: Function) {
    super.getAccount(addr, (err: Error, res: Account) => {
      if (!err && !this.seenKeys.has(addr.toString('hex'))) {