decrease trade step timeout for testnet

This commit is contained in:
woodser 2024-04-24 21:19:25 -04:00
parent ca8cea8e82
commit 4ea5025393
4 changed files with 65 additions and 5 deletions

View File

@ -6158,6 +6158,11 @@ export class Trade extends jspb.Message {
getIsCompleted(): boolean;
setIsCompleted(value: boolean): Trade;
getImportedMultisigHexesList(): Array<string>;
setImportedMultisigHexesList(value: Array<string>): Trade;
clearImportedMultisigHexesList(): Trade;
addImportedMultisigHexes(value: string, index?: number): Trade;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Trade.AsObject;
static toObject(includeInstance: boolean, msg: Trade): Trade.AsObject;
@ -6196,6 +6201,7 @@ export namespace Trade {
counterCurrencyExtraData: string,
uid: string,
isCompleted: boolean,
importedMultisigHexesList: Array<string>,
}
export enum State {

View File

@ -49595,7 +49595,7 @@ proto.io.haveno.protobuffer.Tradable.prototype.hasArbitratorTrade = function() {
* @private {!Array<number>}
* @const
*/
proto.io.haveno.protobuffer.Trade.repeatedFields_ = [20];
proto.io.haveno.protobuffer.Trade.repeatedFields_ = [20,29];
@ -49656,7 +49656,8 @@ proto.io.haveno.protobuffer.Trade.toObject = function(includeInstance, msg) {
refundResultState: jspb.Message.getFieldWithDefault(msg, 25, 0),
counterCurrencyExtraData: jspb.Message.getFieldWithDefault(msg, 26, ""),
uid: jspb.Message.getFieldWithDefault(msg, 27, ""),
isCompleted: jspb.Message.getBooleanFieldWithDefault(msg, 28, false)
isCompleted: jspb.Message.getBooleanFieldWithDefault(msg, 28, false),
importedMultisigHexesList: (f = jspb.Message.getRepeatedField(msg, 29)) == null ? undefined : f
};
if (includeInstance) {
@ -49812,6 +49813,10 @@ proto.io.haveno.protobuffer.Trade.deserializeBinaryFromReader = function(msg, re
var value = /** @type {boolean} */ (reader.readBool());
msg.setIsCompleted(value);
break;
case 29:
var value = /** @type {string} */ (reader.readString());
msg.addImportedMultisigHexes(value);
break;
default:
reader.skipField();
break;
@ -50044,6 +50049,13 @@ proto.io.haveno.protobuffer.Trade.serializeBinaryToWriter = function(message, wr
f
);
}
f = message.getImportedMultisigHexesList();
if (f.length > 0) {
writer.writeRepeatedString(
29,
f
);
}
};
@ -50797,6 +50809,43 @@ proto.io.haveno.protobuffer.Trade.prototype.setIsCompleted = function(value) {
};
/**
* repeated string imported_multisig_hexes = 29;
* @return {!Array<string>}
*/
proto.io.haveno.protobuffer.Trade.prototype.getImportedMultisigHexesList = function() {
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 29));
};
/**
* @param {!Array<string>} value
* @return {!proto.io.haveno.protobuffer.Trade} returns this
*/
proto.io.haveno.protobuffer.Trade.prototype.setImportedMultisigHexesList = function(value) {
return jspb.Message.setField(this, 29, value || []);
};
/**
* @param {string} value
* @param {number=} opt_index
* @return {!proto.io.haveno.protobuffer.Trade} returns this
*/
proto.io.haveno.protobuffer.Trade.prototype.addImportedMultisigHexes = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 29, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.io.haveno.protobuffer.Trade} returns this
*/
proto.io.haveno.protobuffer.Trade.prototype.clearImportedMultisigHexesList = function() {
return this.setImportedMultisigHexesList([]);
};

File diff suppressed because one or more lines are too long

View File

@ -449,7 +449,7 @@ const TestConfig = {
XMR_STAGENET: ["1aa111f817b7fdaaec1c8d5281a1837cc71c336db09b87cf23344a0a4e3bb2cb", "6b5a404eb5ff7154f2357126c84c3becfe2e7c59ca3844954ce9476bec2a6228", "fd4ef301a2e4faa3c77bc26393919895fa29b0908f2bbd51f6f6de3e46fb7a6e"],
XMR_MAINNET: []
},
tradeStepTimeoutMs: 120000,
tradeStepTimeoutMs: getBaseCurrencyNetwork() === BaseCurrencyNetwork.XMR_LOCAL ? 45000 : 180000,
testTimeout: getBaseCurrencyNetwork() === BaseCurrencyNetwork.XMR_LOCAL ? 2400000 : 5400000, // timeout in ms for each test to complete (40 minutes for private network, 90 minutes for public network)
trade: new TradeContext(defaultTradeConfig)
};
@ -2032,7 +2032,7 @@ test("Can handle unexpected errors during trade initialization", async () => {
// TODO: test it's unavailable right after taking (taker will know before maker)
// trader 0's offer remains available
await wait(10000); // give time for trade initialization to fail and offer to become available
await wait(15000); // give time for trade initialization to fail and offer to become available
offer = await traders[0].getMyOffer(offer.getId());
if (offer.getState() !== "AVAILABLE") {
HavenoUtils.log(1, "Offer is not yet available, waiting to become available after timeout..."); // TODO (woodser): fail trade on nack during initialization to save a bunch of time
@ -2359,12 +2359,14 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
const promises: Promise<void>[] = [];
ctx.buyerAppName = ctx.getBuyer().havenod!.getAppName();
if (ctx.buyerOfflineAfterTake) {
HavenoUtils.log(0, "Buyer going offline");
promises.push(releaseHavenoProcess(ctx.getBuyer().havenod!));
if (ctx.isBuyerMaker()) ctx.maker.havenod = undefined;
else ctx.taker.havenod = undefined;
}
ctx.sellerAppName = ctx.getSeller().havenod!.getAppName();
if (ctx.sellerOfflineAfterTake) {
HavenoUtils.log(0, "Seller going offline");
promises.push(releaseHavenoProcess(ctx.getSeller().havenod!));
if (ctx.isBuyerMaker()) ctx.taker.havenod = undefined;
else ctx.maker.havenod = undefined;
@ -2378,6 +2380,7 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
// buyer comes online if offline and used
if (ctx.isStopped) return ctx.offerId!;
if (ctx.buyerOfflineAfterTake && ((ctx.buyerSendsPayment && !ctx.isPaymentSent && ctx.sellerDisputeContext !== DisputeContext.OPEN_AFTER_DEPOSITS_UNLOCK) || (ctx.buyerDisputeContext === DisputeContext.OPEN_AFTER_DEPOSITS_UNLOCK && !ctx.buyerOpenedDispute))) {
HavenoUtils.log(0, "Buyer coming online");
const buyer = await initHaveno({appName: ctx.buyerAppName, excludePorts: ctx.usedPorts}); // change buyer's node address
if (ctx.isBuyerMaker()) ctx.maker.havenod = buyer;
else ctx.taker.havenod = buyer;
@ -2465,6 +2468,7 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
// buyer goes offline if configured
if (ctx.isStopped) return ctx.offerId!;
if (ctx.buyerOfflineAfterPaymentSent) {
HavenoUtils.log(0, "Buyer going offline");
await releaseHavenoProcess(ctx.getBuyer().havenod!);
if (ctx.isBuyerMaker()) ctx.maker.havenod = undefined;
else ctx.taker.havenod = undefined;
@ -2473,6 +2477,7 @@ async function executeTrade(ctxP: Partial<TradeContext>): Promise<string> {
// seller comes online if offline
if (ctx.isStopped) return ctx.offerId!;
if (!ctx.getSeller().havenod) {
HavenoUtils.log(0, "Seller coming online");
const seller = await initHaveno({appName: ctx.sellerAppName, excludePorts: ctx.usedPorts});
if (ctx.isBuyerMaker()) ctx.taker.havenod = seller;
else ctx.maker.havenod = seller;