Skip to content

Commit

Permalink
await deferral of publishing dispute payout tx
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Dec 5, 2024
1 parent bedf3e7 commit 6c0f7bb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/HavenoClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ const TestConfig = {
networkType: getBaseCurrencyNetwork() == BaseCurrencyNetwork.XMR_MAINNET ? moneroTs.MoneroNetworkType.MAINNET : getBaseCurrencyNetwork() == BaseCurrencyNetwork.XMR_LOCAL ? moneroTs.MoneroNetworkType.TESTNET : moneroTs.MoneroNetworkType.STAGENET,
moneroBinsDir: "../haveno/.localnet",
testDataDir: "./testdata",
deferralMs: 250000,
haveno: {
path: "../haveno",
version: "1.0.14"
Expand Down Expand Up @@ -3179,6 +3180,12 @@ async function resolveDispute(ctxP: Partial<TradeContext>) {
assert(dispute.getIsClosed(), "Dispute is not closed for opener's peer, trade " + ctx.offerId);
}

// wait for deferral of payout publish if applicable
if (ctx.getDisputeOpener() && ctx.disputeWinner === DisputeResult.Winner.SELLER && ctx.sellerOfflineAfterDisputeOpened || ctx.disputeWinner === DisputeResult.Winner.BUYER && ctx.buyerOfflineAfterDisputeOpened) {
HavenoUtils.log(0, "Awaiting deferral of publishing dispute payout tx");
await wait(TestConfig.deferralMs); // wait for deferral
}

// test trade state
if (ctx.getBuyer().havenod) await testTradeState(await ctx.getBuyer().havenod!.getTrade(ctx.offerId!), {phase: ctx.getPhase(), payoutState: ["PAYOUT_PUBLISHED", "PAYOUT_CONFIRMED", "PAYOUT_UNLOCKED"], disputeState: "DISPUTE_CLOSED", isCompleted: true, isPayoutPublished: true});
if (ctx.getSeller().havenod) await testTradeState(await ctx.getSeller().havenod!.getTrade(ctx.offerId!), {phase: ctx.getPhase(), payoutState: ["PAYOUT_PUBLISHED", "PAYOUT_CONFIRMED", "PAYOUT_UNLOCKED"], disputeState: "DISPUTE_CLOSED", isCompleted: true, isPayoutPublished: true});
Expand Down

0 comments on commit 6c0f7bb

Please sign in to comment.