Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct main path for wallet rpc client #3934

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions applications/daily_tests/washing_machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function WashingMachine(options) {
this.wallet2 = new WalletClient();
debug(`Connecting to wallet2 at ${wallet2Grpc}...`);
await this.wallet2.connect(wallet2Grpc);
debug(`Connected.`);
} else {
debug("Compiling wallet2...");
const port = await getFreePort(20000, 25000);
Expand Down Expand Up @@ -282,11 +283,16 @@ async function sendFunds(senderWallet, receiverWallet, options) {
);
// For interactive transactions, a coin split is needed first
if (!options.oneSided) {
let avgAmountPerTransaction = totalToSend / transactions.length;
let avgAmountPerTransaction = Math.floor(totalToSend / transactions.length);
debug(`COINSPLIT: amount = ${avgAmountPerTransaction}uT`);
if (transactions.length > 1) {
let leftToSplit = transactions.length;
while (leftToSplit > 499) {
// Wait for balance + 1t leeway for fees
await waitForBalance(
senderWallet,
avgAmountPerTransaction * 499 + 1000000
);
let split_result = await senderWallet.coin_split({
amount_per_split: avgAmountPerTransaction,
split_count: 499,
Expand All @@ -296,6 +302,11 @@ async function sendFunds(senderWallet, receiverWallet, options) {
leftToSplit -= 499;
}
if (leftToSplit > 0) {
// Wait for balance + 1t leeway for fees
await waitForBalance(
senderWallet,
avgAmountPerTransaction * leftToSplit + 1000000
);
let split_result = await senderWallet.coin_split({
amount_per_split: avgAmountPerTransaction,
split_count: leftToSplit,
Expand Down Expand Up @@ -388,7 +399,11 @@ async function waitForBalance(client, balance) {
}
await sleep(1000);
if (i >= 60) {
debug(`Still waiting... [t=${r * i}s]`);
debug(
`Still waiting... [t=${r * i}s, balance=${
newBalance.available_balance
}, pending=${newBalance.pending_incoming_balance}]`
);
i = 0;
r++;
} else {
Expand Down
Loading