mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Move contractHash creation to MakerCreateAndSignContract
This commit is contained in:
parent
0f36ae8928
commit
538db2f36f
2 changed files with 6 additions and 5 deletions
|
@ -26,7 +26,6 @@ import bisq.core.trade.Trade;
|
||||||
import bisq.core.trade.protocol.TradingPeer;
|
import bisq.core.trade.protocol.TradingPeer;
|
||||||
import bisq.core.trade.protocol.tasks.TradeTask;
|
import bisq.core.trade.protocol.tasks.TradeTask;
|
||||||
|
|
||||||
import bisq.common.crypto.Hash;
|
|
||||||
import bisq.common.taskrunner.TaskRunner;
|
import bisq.common.taskrunner.TaskRunner;
|
||||||
|
|
||||||
import org.bitcoinj.core.Address;
|
import org.bitcoinj.core.Address;
|
||||||
|
@ -60,9 +59,6 @@ public class BuyerAsMakerCreatesAndSignsDepositTx extends TradeTask {
|
||||||
TradingPeer tradingPeer = processModel.getTradingPeer();
|
TradingPeer tradingPeer = processModel.getTradingPeer();
|
||||||
Offer offer = checkNotNull(trade.getOffer());
|
Offer offer = checkNotNull(trade.getOffer());
|
||||||
|
|
||||||
byte[] contractHash = Hash.getSha256Hash(checkNotNull(trade.getContractAsJson()));
|
|
||||||
trade.setContractHash(contractHash);
|
|
||||||
|
|
||||||
Coin makerInputAmount = offer.getBuyerSecurityDeposit();
|
Coin makerInputAmount = offer.getBuyerSecurityDeposit();
|
||||||
Optional<AddressEntry> addressEntryOptional = walletService.getAddressEntry(id, AddressEntry.Context.MULTI_SIG);
|
Optional<AddressEntry> addressEntryOptional = walletService.getAddressEntry(id, AddressEntry.Context.MULTI_SIG);
|
||||||
checkArgument(addressEntryOptional.isPresent(), "addressEntryOptional must be present");
|
checkArgument(addressEntryOptional.isPresent(), "addressEntryOptional must be present");
|
||||||
|
@ -87,7 +83,7 @@ public class BuyerAsMakerCreatesAndSignsDepositTx extends TradeTask {
|
||||||
"buyerPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
|
"buyerPubKey from AddressEntry must match the one from the trade data. trade id =" + id);
|
||||||
|
|
||||||
PreparedDepositTxAndMakerInputs result = processModel.getTradeWalletService().buyerAsMakerCreatesAndSignsDepositTx(
|
PreparedDepositTxAndMakerInputs result = processModel.getTradeWalletService().buyerAsMakerCreatesAndSignsDepositTx(
|
||||||
contractHash,
|
trade.getContractHash(),
|
||||||
makerInputAmount,
|
makerInputAmount,
|
||||||
msOutputAmount,
|
msOutputAmount,
|
||||||
takerRawTransactionInputs,
|
takerRawTransactionInputs,
|
||||||
|
|
|
@ -27,6 +27,7 @@ import bisq.core.trade.protocol.tasks.TradeTask;
|
||||||
|
|
||||||
import bisq.network.p2p.NodeAddress;
|
import bisq.network.p2p.NodeAddress;
|
||||||
|
|
||||||
|
import bisq.common.crypto.Hash;
|
||||||
import bisq.common.crypto.Sig;
|
import bisq.common.crypto.Sig;
|
||||||
import bisq.common.taskrunner.TaskRunner;
|
import bisq.common.taskrunner.TaskRunner;
|
||||||
import bisq.common.util.Utilities;
|
import bisq.common.util.Utilities;
|
||||||
|
@ -93,6 +94,10 @@ public class MakerCreateAndSignContract extends TradeTask {
|
||||||
trade.setContract(contract);
|
trade.setContract(contract);
|
||||||
trade.setContractAsJson(contractAsJson);
|
trade.setContractAsJson(contractAsJson);
|
||||||
trade.setMakerContractSignature(signature);
|
trade.setMakerContractSignature(signature);
|
||||||
|
|
||||||
|
byte[] contractHash = Hash.getSha256Hash(checkNotNull(trade.getContractAsJson()));
|
||||||
|
trade.setContractHash(contractHash);
|
||||||
|
|
||||||
processModel.setMyMultiSigPubKey(makerMultiSigPubKey);
|
processModel.setMyMultiSigPubKey(makerMultiSigPubKey);
|
||||||
|
|
||||||
complete();
|
complete();
|
||||||
|
|
Loading…
Add table
Reference in a new issue