Skip to content

Commit

Permalink
Try using explorer first when sending transaction (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino authored Nov 12, 2024
1 parent 5503176 commit 77228dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class RPCNodeNetwork extends Network {

async #callRPC(api, isText = false) {
const cRes = await this.#fetchNode(api);
if (!cRes.ok) throw new Error('Failed to call rpc');
const cResTxt = await cRes.text();
if (isText) return cResTxt;
// RPC calls with filters might return empty string instead of empty JSON,
Expand Down
6 changes: 5 additions & 1 deletion scripts/network/network_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ class NetworkManager {

async sendTransaction(hex) {
try {
const data = await this.#retryWrapper('sendTransaction', true, hex);
const data = await this.#retryWrapper(
'sendTransaction',
false,
hex
);

// Throw and catch if the data is not a TXID
if (!data.result || data.result.length !== 64) throw data;
Expand Down

0 comments on commit 77228dd

Please sign in to comment.