[bisq-network/bisq] Implement Segwit for BSQ (#5000)
chimp1984
notifications at github.com
Sat Jan 16 20:40:04 CET 2021
@chimp1984 requested changes on this pull request.
Beside the suggestion to use a block height for activating the change all looks good to me.
> if (pubKeyAsHex == null) {
log.debug("pubKeyAsHex is not set as we received a not supported sigScript. " +
"txId={}, asm={}, txInWitness={}",
rawDtoTx.getTxId(), rawInput.getScriptSig().getAsm(), rawInput.getTxInWitness());
}
- return new TxInput(rawInput.getTxId(), rawInput.getVOut(), pubKeyAsHex);
+ var txInput = new TxInput(rawInput.getTxId(), rawInput.getVOut(), pubKeyAsHex);
+ txInput.isSegwit = rawInput.getTxInWitness() != null;
Wouldn't it be better to add that to the constructor so the TxInput is immutable?
> @@ -246,8 +254,10 @@ private static RawTx getTxFromRawTransaction(RawTransaction rawDtoTx,
// To maintain backwards compatibility when serializing and hashing the DAO state,
// segwit pubKeys are only extracted for the first input, as this will always be a
// BSQ input. Later inputs might be segwit BTC, which would have had a null pubKey
- // recorded in the DAO state prior to the segwit upgrade of the RPC client.
- String pubKeyAsHex = extractPubKeyAsHex(rawInput, rawInput == rawDtoTx.getVIn().get(0));
+ // recorded in the DAO state prior to the segwit upgrade of the RPC client. Spurious
+ // segwit BSQ inputs in txs mined prior to the upgrade also require exclusion.
+ String pubKeyAsHex = extractPubKeyAsHex(rawInput, rawInput == rawDtoTx.getVIn().get(0) &&
+ !BSQ_TXS_DISALLOWING_SEGWIT_PUB_KEYS.contains(txId));
Wouldn't it be better to use a block height at which we activate the support for segwit inputs. It is technically a hard fork which would become activated at that block height.
That should also cover the past tx(s) with a segwit input.
--
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/5000#pullrequestreview-564669999
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210116/7c864aa6/attachment-0001.htm>
More information about the bisq-github
mailing list