doc, tests: Test sequence diagrams are accurate.

Add delay between detecting PTX and redeeming ITX.
Add bid state history to json api.
Hide Tx none states in bid state history.
This commit is contained in:
tecnovert
2022-07-03 23:58:16 +02:00
parent a2afd3f00f
commit 0c620ea388
13 changed files with 738 additions and 297 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020 tecnovert
# Copyright (c) 2020-2022 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
@@ -11,7 +11,6 @@ from basicswap.script import (
OpCodes,
)
INITIATE_TX_TIMEOUT = 40 * 60 # TODO: make variable per coin
@@ -48,3 +47,14 @@ def buildContractScript(lock_val, secret_hash, pkh_redeem, pkh_refund, op_lock=O
def extractScriptSecretHash(script):
return script[7:39]
def redeemITx(self, bid_id, session):
bid, offer = self.getBidAndOffer(bid_id, session)
ci_from = self.ci(offer.coin_from)
txn = self.createRedeemTxn(ci_from.coin_type(), bid, for_txn_type='initiate')
txid = self.submitTxn(ci_from.coin_type(), txn)
bid.initiate_tx.spend_txid = bytes.fromhex(txid)
self.log.debug('Submitted initiate redeem txn %s to %s chain for bid %s', txid, ci_from.coin_name(), bid_id.hex())