get payout tx id from seller or arbitrator

This commit is contained in:
woodser 2024-09-25 09:40:31 -04:00
parent e9f527793f
commit 006ce39cfd

View File

@ -2635,10 +2635,13 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
// record balances on completion // record balances on completion
if (ctx.isStopped) return ctx.offerId!; if (ctx.isStopped) return ctx.offerId!;
if (!ctx.maker.balancesAfterPayout) { if (!ctx.maker.balancesAfterPayout) {
ctx.payoutTxId = (await ctx.getBuyer().havenod!.getTrade(ctx.offerId!)).getPayoutTxId();
if (!ctx.payoutTxId) ctx.payoutTxId = (await ctx.arbitrator.havenod!.getTrade(ctx.offerId!)).getPayoutTxId(); // TODO: arbitrator will sign and publish payout tx id if buyer is offline; detect payout tx id on 0 conf
ctx.maker.balancesAfterPayout = await ctx.maker.havenod?.getBalances(); ctx.maker.balancesAfterPayout = await ctx.maker.havenod?.getBalances();
ctx.taker.balancesAfterPayout = await ctx.taker.havenod?.getBalances(); ctx.taker.balancesAfterPayout = await ctx.taker.havenod?.getBalances();
// record payout tx id
ctx.payoutTxId = (await ctx.getSeller().havenod!.getTrade(ctx.offerId!)).getPayoutTxId();
if (!ctx.payoutTxId) ctx.payoutTxId = (await ctx.arbitrator.havenod!.getTrade(ctx.offerId!)).getPayoutTxId(); // TODO: arbitrator will sign and publish payout tx id if buyer is offline; detect payout tx id on 0 conf
if (!ctx.payoutTxId) ctx.payoutTxId = (await ctx.getBuyer().havenod!.getTrade(ctx.offerId!)).getPayoutTxId(); // TODO: arbitrator does not have payout tx id until first confirmation because they defer publishing
} }
// test balances after payout tx unless other trades can interfere // test balances after payout tx unless other trades can interfere