From fc0ed02b8932d4ef06abf5fd3dae573f36f2150a Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 14 Nov 2025 09:29:00 -0400 Subject: [PATCH] fix arbitrator observing payout by waiting notice + startup time (#402) --- src/HavenoClient.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/HavenoClient.test.ts b/src/HavenoClient.test.ts index c114ae96..553beb3a 100644 --- a/src/HavenoClient.test.ts +++ b/src/HavenoClient.test.ts @@ -3009,14 +3009,12 @@ async function executeTrade(ctxP: Partial): Promise { ctx.isPaymentReceived = true; fetchedTrade = await ctx.getSeller().havenod!.getTrade(trade.getTradeId()); expect(fetchedTrade.getPhase()).toEqual("PAYMENT_RECEIVED"); - let isBuyerOffline = ctx.getBuyer().havenod === undefined; - await wait((isBuyerOffline ? ctx.maxWalletStartupMs : 0) + ctx.walletSyncPeriodMs * 2); // buyer or arbitrator will sign and publish payout tx (arbitrator is idling) + await wait(ctx.maxTimePeerNoticeMs + ctx.maxWalletStartupMs + ctx.walletSyncPeriodMs); // buyer or arbitrator will sign and publish payout tx (arbitrator is idling) await testTradeState(await ctx.getSeller().havenod!.getTrade(trade.getTradeId()), {phase: ["PAYMENT_RECEIVED"], payoutState: ["PAYOUT_PUBLISHED", "PAYOUT_CONFIRMED", "PAYOUT_UNLOCKED", "PAYOUT_FINALIZED"], isCompleted: false, isPayoutPublished: true}); } // payout tx is published by buyer (priority) or arbitrator if (ctx.isStopped) return ctx.offerId!; - await wait(ctx.walletSyncPeriodMs); await testTradeState(await ctx.getSeller().havenod!.getTrade(trade.getTradeId()), {phase: ["PAYMENT_RECEIVED"], payoutState: ["PAYOUT_PUBLISHED", "PAYOUT_CONFIRMED", "PAYOUT_UNLOCKED", "PAYOUT_FINALIZED"], isCompleted: false, isPayoutPublished: true}); await testTradeState(await ctx.arbitrator.havenod!.getTrade(trade.getTradeId()), {phase: ["PAYMENT_RECEIVED"], payoutState: ["PAYOUT_PUBLISHED", "PAYOUT_CONFIRMED", "PAYOUT_UNLOCKED", "PAYOUT_FINALIZED"], isCompleted: true, isPayoutPublished: true}); // arbitrator trade auto completes