[bisq-network/bisq] [WIP] Segwit for the trade protocol (#4612)
Oscar Guindzberg
notifications at github.com
Thu Oct 22 14:44:32 UTC 2020
@oscarguindzberg commented on this pull request.
> @@ -1286,11 +1286,7 @@ private void signInput(Transaction transaction, TransactionInput input, int inpu
input.setScriptSig(ScriptBuilder.createInputScript(txSig, sigKey));
}
} else if (ScriptPattern.isP2WPKH(scriptPubKey)) {
- // TODO: Consider using this alternative way to build the scriptCode (taken from bitcoinj master)
- // Script scriptCode = ScriptBuilder.createP2PKHOutputScript(sigKey)
- Script scriptCode = new ScriptBuilder().data(
- ScriptBuilder.createOutputScript(LegacyAddress.fromKey(transaction.getParams(), sigKey)).getProgram())
- .build();
+ Script scriptCode = ScriptBuilder.createP2PKHOutputScript(sigKey);
Yes, it is correct.
I know it sounds weird.
To sign a P2WPKH input you have to serialize the tx with a specific format, hash it and then sign the hash.
That specific format includes something called the scriptCode which should be: OP_DUP OP_HASH160 pubKeyHash OP_EQUALVERIFY OP_CHECKSIG. That is the same script format used in P2PKH outputs.
Detailed info: https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4612#discussion_r510220798
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201022/8181c72d/attachment-0001.html>
More information about the bisq-github
mailing list