mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Script: Fix getNumberOfBytesRequiredToSpend() for P2WPKH.
This commit is contained in:
parent
30297af3de
commit
0317c192e5
@ -619,11 +619,13 @@ public class Script {
|
|||||||
return SIG_SIZE;
|
return SIG_SIZE;
|
||||||
} else if (ScriptPattern.isP2PKH(this)) {
|
} else if (ScriptPattern.isP2PKH(this)) {
|
||||||
// scriptSig: <sig> <pubkey>
|
// scriptSig: <sig> <pubkey>
|
||||||
int uncompressedPubKeySize = 65;
|
int uncompressedPubKeySize = 65; // very conservative
|
||||||
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : uncompressedPubKeySize);
|
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : uncompressedPubKeySize);
|
||||||
} else if (ScriptPattern.isP2WPKH(this)) {
|
} else if (ScriptPattern.isP2WPKH(this)) {
|
||||||
// scriptSig is empty
|
// scriptSig is empty
|
||||||
return 0;
|
// witness: <sig> <pubKey>
|
||||||
|
int compressedPubKeySize = 33;
|
||||||
|
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : compressedPubKeySize);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Unsupported script type");
|
throw new IllegalStateException("Unsupported script type");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user