TxBuilder: disable Address object as valid input
This commit is contained in:
parent
e9193df290
commit
abd27dd2be
2 changed files with 1 additions and 15 deletions
|
@ -188,12 +188,7 @@ TransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {
|
|||
|
||||
// Attempt to get a valid address if it's a base58 address string
|
||||
if (typeof scriptPubKey === 'string') {
|
||||
scriptPubKey = Address.fromBase58Check(scriptPubKey)
|
||||
}
|
||||
|
||||
// Attempt to get a valid script if it's an Address object
|
||||
if (scriptPubKey instanceof Address) {
|
||||
scriptPubKey = scriptPubKey.toOutputScript()
|
||||
scriptPubKey = Address.fromBase58Check(scriptPubKey).toOutputScript()
|
||||
}
|
||||
|
||||
return this.tx.addOutput(scriptPubKey, value)
|
||||
|
|
|
@ -133,15 +133,6 @@ describe('TransactionBuilder', function () {
|
|||
assert.strictEqual(txout.value, 1000)
|
||||
})
|
||||
|
||||
it('accepts an Address object and value', function () {
|
||||
var vout = txb.addOutput(privAddress, 1000)
|
||||
assert.strictEqual(vout, 0)
|
||||
|
||||
var txout = txb.tx.outs[0]
|
||||
assert.deepEqual(txout.script, privScript)
|
||||
assert.strictEqual(txout.value, 1000)
|
||||
})
|
||||
|
||||
it('accepts a ScriptPubKey and value', function () {
|
||||
var vout = txb.addOutput(privScript, 1000)
|
||||
assert.strictEqual(vout, 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue