forked from Qortal/qortal
Allow 3 retries for getTransaction() and getAddressTransactions() requests
This commit is contained in:
parent
9b43e4ea3d
commit
8ac298e07d
@ -229,6 +229,25 @@ public abstract class Bitcoiny implements ForeignBlockchain {
|
|||||||
return transaction.getOutputs();
|
return transaction.getOutputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns transactions for passed script
|
||||||
|
* <p>
|
||||||
|
* @throws ForeignBlockchainException if error occurs
|
||||||
|
*/
|
||||||
|
public List<TransactionHash> getAddressTransactions(byte[] scriptPubKey, boolean includeUnconfirmed) throws ForeignBlockchainException {
|
||||||
|
int retries = 0;
|
||||||
|
ForeignBlockchainException e2 = null;
|
||||||
|
while (retries <= 3) {
|
||||||
|
try {
|
||||||
|
return this.blockchain.getAddressTransactions(scriptPubKey, includeUnconfirmed);
|
||||||
|
} catch (ForeignBlockchainException e) {
|
||||||
|
e2 = e;
|
||||||
|
retries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw(e2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of transaction hashes pertaining to passed address.
|
* Returns list of transaction hashes pertaining to passed address.
|
||||||
* <p>
|
* <p>
|
||||||
@ -263,7 +282,17 @@ public abstract class Bitcoiny implements ForeignBlockchain {
|
|||||||
* @throws ForeignBlockchainException if error occurs
|
* @throws ForeignBlockchainException if error occurs
|
||||||
*/
|
*/
|
||||||
public BitcoinyTransaction getTransaction(String txHash) throws ForeignBlockchainException {
|
public BitcoinyTransaction getTransaction(String txHash) throws ForeignBlockchainException {
|
||||||
|
int retries = 0;
|
||||||
|
ForeignBlockchainException e2 = null;
|
||||||
|
while (retries <= 3) {
|
||||||
|
try {
|
||||||
return this.blockchain.getTransaction(txHash);
|
return this.blockchain.getTransaction(txHash);
|
||||||
|
} catch (ForeignBlockchainException e) {
|
||||||
|
e2 = e;
|
||||||
|
retries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw(e2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user