From f05058b5877bc0685369c1763bcc81cf9c83a935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Fri, 8 Oct 2021 18:18:31 +0100 Subject: [PATCH] fix: hd index usage --- bin/lamassu-eth-recovery | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/lamassu-eth-recovery b/bin/lamassu-eth-recovery index b6f84b5a..da8df715 100644 --- a/bin/lamassu-eth-recovery +++ b/bin/lamassu-eth-recovery @@ -3,6 +3,7 @@ const hdkey = require('ethereumjs-wallet/hdkey') const hkdf = require('futoin-hkdf') const db = require('../lib/db') +const _ = require('lodash/fp') const mnemonicHelpers = require('../lib/mnemonic-helpers') const pify = require('pify') @@ -40,6 +41,12 @@ function run (address) { function searchForHdIndex (address) { const sql = `SELECT hd_index FROM cash_out_txs WHERE to_address = $1` return db.oneOrNone(sql, [address]) + .then(result => { + const index = _.get('hd_index', result) + if (!_.isNil(index)) return index + console.error(`Error: Unable to find the HD index for this given address: ${address}`) + process.exit(3) + }) } function fetchMnemonic () {