Code Duplication    Length = 16-19 lines in 2 locations

lib/wallet.js 2 locations

@@ 789-807 (lines=19) @@
786
        self.sdk.doWalletDiscovery(self.identifier, gap)
787
            .then(function(result) {
788
                return [result.confirmed, result.unconfirmed];
789
            })
790
    );
791
792
    return deferred.promise;
793
};
794
795
/**
796
 *
797
 * @param [force]   bool            ignore warnings (such as non-zero balance)
798
 * @param [cb]      function        callback(err, success)
799
 * @returns {q.Promise}
800
 */
801
Wallet.prototype.deleteWallet = function(force, cb) {
802
    var self = this;
803
804
    if (typeof force === "function") {
805
        cb = force;
806
        force = false;
807
    }
808
809
    var deferred = q.defer();
810
    deferred.promise.nodeify(cb);
@@ 867-882 (lines=16) @@
864
    } else if (typeof options === "function") {
865
        cb = options;
866
        options = {};
867
    }
868
869
    randomizeChangeIdx = typeof randomizeChangeIdx !== "undefined" ? randomizeChangeIdx : true;
870
    feeStrategy = feeStrategy || Wallet.FEE_STRATEGY_OPTIMAL;
871
    options = options || {};
872
    var checkFee = typeof options.checkFee !== "undefined" ? options.checkFee : true;
873
874
    var deferred = q.defer();
875
    deferred.promise.nodeify(cb);
876
877
    if (self.locked) {
878
        deferred.reject(new blocktrail.WalletLockedError("Wallet needs to be unlocked to send coins"));
879
        return deferred.promise;
880
    }
881
882
    q.nextTick(function() {
883
        deferred.notify(Wallet.PAY_PROGRESS_START);
884
        self.buildTransaction(pay, changeAddress, allowZeroConf, randomizeChangeIdx, feeStrategy, options)
885
            .then(