[bisq-network/bisq] Apply rule to not allow BSQ outputs after BTC output for regular txs (#3413)
sqrrm
notifications at github.com
Mon Oct 21 22:01:46 UTC 2019
sqrrm commented on this pull request.
> daoKillSwitch.assertDaoIsNotDisabled();
- final Transaction tx = new Transaction(params);
- addInputsAndChangeOutputForTx(tx, fee, bsqCoinSelector, requireChangeOutput);
- // printTx("getPreparedFeeTx", tx);
- return tx;
+
+ Transaction tx = new Transaction(params);
+ // We look for inputs covering out BSQ fee we want to pay.
+ CoinSelection coinSelection = bsqCoinSelector.select(fee, wallet.calculateAllSpendCandidates());
It would be better to include the dust here in the initial coin selection since it is a requirement that it's included. Then there is no need to do a double take when this initial selection wasn't enough.
> + return false;
+ }
+
+ // Burned BSQ output is last output before opReturn.
+ // We could have also a BSQ change output as last output before opReturn but that will
+ // be detected at blindVoteFee check.
+ // We always have the BSQ change before the burned BSQ output if both are present.
+ checkArgument(optionalOpReturnIndex.isPresent());
+ if (index != optionalOpReturnIndex.get() - 1) {
+ return false;
+ }
+
+ // Without checking the fee we would not be able to distinguish between 2 structurally same transactions, one
+ // where the output is burned BSQ and one where it is a BSQ change output.
+ long blindVoteFee = daoStateService.getParamValueAsCoin(Param.BLIND_VOTE_FEE, tempTxOutput.getBlockHeight()).value;
+ return availableInputValue == blindVoteFee;
What happens with a vote that's using the wrong fee. It would set this output to BSQ, but would it fail to register as a valid vote?
--
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/3413#pullrequestreview-304707502
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191021/0cc0caed/attachment.html>
More information about the bisq-github
mailing list