payments: cleanup
This commit is contained in:
parent
54ec449a75
commit
3ed77c4820
3 changed files with 3 additions and 7 deletions
|
@ -58,13 +58,10 @@ function p2pk (a, opts) {
|
|||
|
||||
// extended validation
|
||||
if (opts.validate) {
|
||||
if (a.pubkey && a.output) {
|
||||
if (!a.pubkey.equals(o.pubkey)) throw new TypeError('Pubkey mismatch')
|
||||
}
|
||||
|
||||
if (a.output) {
|
||||
if (a.output[a.output.length - 1] !== OPS.OP_CHECKSIG) throw new TypeError('Output is invalid')
|
||||
if (!ecc.isPoint(o.pubkey)) throw new TypeError('Output pubkey is invalid')
|
||||
if (a.pubkey && !a.pubkey.equals(o.pubkey)) throw new TypeError('Pubkey mismatch')
|
||||
}
|
||||
|
||||
if (a.signature) {
|
||||
|
@ -73,7 +70,7 @@ function p2pk (a, opts) {
|
|||
|
||||
if (a.input) {
|
||||
if (_chunks().length !== 1) throw new TypeError('Input is invalid')
|
||||
if (!bscript.isCanonicalScriptSignature(_chunks()[0])) throw new TypeError('Input has invalid signature')
|
||||
if (!bscript.isCanonicalScriptSignature(o.signature)) throw new TypeError('Input has invalid signature')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ function p2wpkh (a, opts) {
|
|||
if (network && network.bech32 !== _address().prefix) throw new TypeError('Invalid prefix or Network mismatch')
|
||||
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
||||
if (_address().data.length !== 20) throw new TypeError('Invalid address data')
|
||||
// if (hash && !hash.equals(_address().data)) throw new TypeError('Hash mismatch')
|
||||
hash = _address().data
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ function p2wsh (a, opts) {
|
|||
if (_address().prefix !== network.bech32) throw new TypeError('Invalid prefix or Network mismatch')
|
||||
if (_address().version !== 0x00) throw new TypeError('Invalid address version')
|
||||
if (_address().data.length !== 32) throw new TypeError('Invalid address data')
|
||||
else hash = _address().data
|
||||
hash = _address().data
|
||||
}
|
||||
|
||||
if (a.hash) {
|
||||
|
|
Loading…
Add table
Reference in a new issue