From 590bb8e1c3487ce57643a268655f0f57d915ab1f Mon Sep 17 00:00:00 2001 From: William Cotton Date: Fri, 25 Apr 2014 12:49:51 -0700 Subject: [PATCH] custom changeAddress for wallet.createTx() --- src/wallet.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet.js b/src/wallet.js index 5cad501..a4aa0a4 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -170,7 +170,7 @@ function Wallet(seed, options) { }) } - this.createTx = function(to, value, fixedFee) { + this.createTx = function(to, value, fixedFee, changeAddress) { checkDust(value) var tx = new Transaction() @@ -190,7 +190,7 @@ function Wallet(seed, options) { var change = totalInValue - value - fee if(change > 0 && !isDust(change)) { - tx.addOutput(getChangeAddress(), change, Network[network]) + tx.addOutput(changeAddress || getChangeAddress(), change, Network[network]) } break }