mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Move contractHash creation to TakerVerifyAndSignContract
This commit is contained in:
parent
2aa5feebc1
commit
9966f9a9a8
2 changed files with 6 additions and 10 deletions
|
@ -25,7 +25,6 @@ import bisq.core.trade.Trade;
|
|||
import bisq.core.trade.protocol.TradingPeer;
|
||||
import bisq.core.trade.protocol.tasks.TradeTask;
|
||||
|
||||
import bisq.common.crypto.Hash;
|
||||
import bisq.common.taskrunner.TaskRunner;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -50,13 +49,6 @@ public class SellerAsTakerSignsDepositTx extends TradeTask {
|
|||
protected void run() {
|
||||
try {
|
||||
runInterceptHook();
|
||||
log.debug("\n\n------------------------------------------------------------\n"
|
||||
+ "Contract as json\n"
|
||||
+ trade.getContractAsJson()
|
||||
+ "\n------------------------------------------------------------\n");
|
||||
|
||||
byte[] contractHash = Hash.getSha256Hash(checkNotNull(trade.getContractAsJson()));
|
||||
trade.setContractHash(contractHash);
|
||||
|
||||
List<RawTransactionInput> sellerInputs = checkNotNull(processModel.getRawTransactionInputs(), "sellerInputs must not be null");
|
||||
BtcWalletService walletService = processModel.getBtcWalletService();
|
||||
|
@ -79,7 +71,7 @@ public class SellerAsTakerSignsDepositTx extends TradeTask {
|
|||
|
||||
Transaction depositTx = processModel.getTradeWalletService().takerSignsDepositTx(
|
||||
true,
|
||||
contractHash,
|
||||
trade.getContractHash(),
|
||||
processModel.getPreparedDepositTx(),
|
||||
checkNotNull(tradingPeer.getRawTransactionInputs()),
|
||||
sellerInputs,
|
||||
|
|
|
@ -28,6 +28,7 @@ import bisq.core.trade.protocol.tasks.TradeTask;
|
|||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
||||
import bisq.common.crypto.Hash;
|
||||
import bisq.common.crypto.Sig;
|
||||
import bisq.common.taskrunner.TaskRunner;
|
||||
import bisq.common.util.Utilities;
|
||||
|
@ -108,13 +109,16 @@ public class TakerVerifyAndSignContract extends TradeTask {
|
|||
String signature = Sig.sign(processModel.getKeyRing().getSignatureKeyPair().getPrivate(), contractAsJson);
|
||||
trade.setContract(contract);
|
||||
trade.setContractAsJson(contractAsJson);
|
||||
|
||||
byte[] contractHash = Hash.getSha256Hash(checkNotNull(contractAsJson));
|
||||
trade.setContractHash(contractHash);
|
||||
|
||||
trade.setTakerContractSignature(signature);
|
||||
try {
|
||||
checkNotNull(maker.getPubKeyRing(), "maker.getPubKeyRing() must nto be null");
|
||||
Sig.verify(maker.getPubKeyRing().getSignaturePubKey(),
|
||||
contractAsJson,
|
||||
maker.getContractSignature());
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
failed("Contract signature verification failed. " + t.getMessage());
|
||||
|
|
Loading…
Add table
Reference in a new issue