bitcore-lib
Advanced tools
Comparing version 10.2.1 to 10.3.0
@@ -110,3 +110,3 @@ const crypto = require('crypto'); | ||
if (signature.length !== 64) { | ||
throw new Error('Signature should be a 64 byte buffer'); | ||
throw new Error('Signature should be a 64 byte buffer. Got ' + signature.length + ' bytes'); | ||
} | ||
@@ -113,0 +113,0 @@ |
@@ -949,3 +949,7 @@ 'use strict'; | ||
if (typeof to === 'string') { | ||
to = PublicKey.fromTaproot(to); | ||
try { | ||
to = PublicKey.fromTaproot(to); | ||
} catch { | ||
to = Address.fromString(to); | ||
} | ||
} | ||
@@ -952,0 +956,0 @@ |
@@ -43,3 +43,3 @@ const inherits = require('inherits'); | ||
} | ||
return [new TransactionSignature({ | ||
const txSig = new TransactionSignature({ | ||
publicKey: privateKey.publicKey, | ||
@@ -51,3 +51,4 @@ prevTxId: this.prevTxId, | ||
sigtype: sigtype | ||
})]; | ||
}); | ||
return this.isValidSignature(transaction, txSig) ? [txSig] : []; | ||
}; | ||
@@ -79,3 +80,3 @@ | ||
TaprootInput.prototype.isFullySigned = function() { | ||
return this.output.script.isTaproot() || this.hasWitnesses(); | ||
return this.output.script.isTaproot() && this.hasWitnesses(); | ||
}; | ||
@@ -109,2 +110,15 @@ | ||
// TODO verify that this is the correct MAX size. | ||
TaprootInput.SCRIPT_MAX_SIZE = 66; // numwitnesses (1) + sigsize (1 + 64) | ||
TaprootInput.prototype._estimateSize = function() { | ||
let result = this._getBaseSize(); | ||
result += 1; // script size | ||
const WITNESS_DISCOUNT = 4; | ||
const witnessSize = TaprootInput.SCRIPT_MAX_SIZE / WITNESS_DISCOUNT; | ||
result += witnessSize; | ||
return result; | ||
}; | ||
module.exports = TaprootInput; |
{ | ||
"name": "bitcore-lib", | ||
"version": "10.2.1", | ||
"version": "10.3.0", | ||
"description": "A pure and powerful JavaScript Bitcoin library.", | ||
@@ -54,3 +54,3 @@ "author": "BitPay <dev@bitpay.com>", | ||
"license": "MIT", | ||
"gitHead": "3e2d392a3dd5f0ddbed30514eb8dfbaf8da690ae" | ||
"gitHead": "eafcf339de16d7b29642597c65670388825c306c" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14753399
155
88855