mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-14 11:15:49 +00:00
WIP: trade-bot: detect and remove mempool entries from ElectrumX "listunspent" results
This commit is contained in:
parent
7fd7104f46
commit
16581766c6
@ -226,9 +226,13 @@ public class ElectrumX {
|
|||||||
for (Object rawUnspent : (JSONArray) unspentJson) {
|
for (Object rawUnspent : (JSONArray) unspentJson) {
|
||||||
JSONObject unspent = (JSONObject) rawUnspent;
|
JSONObject unspent = (JSONObject) rawUnspent;
|
||||||
|
|
||||||
|
int height = ((Long) unspent.get("height")).intValue();
|
||||||
|
// We only want unspent outputs from confirmed transactions (and definitely not mempool duplicates with height 0)
|
||||||
|
if (height <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
byte[] txHash = HashCode.fromString((String) unspent.get("tx_hash")).asBytes();
|
byte[] txHash = HashCode.fromString((String) unspent.get("tx_hash")).asBytes();
|
||||||
int outputIndex = ((Long) unspent.get("tx_pos")).intValue();
|
int outputIndex = ((Long) unspent.get("tx_pos")).intValue();
|
||||||
int height = ((Long) unspent.get("height")).intValue();
|
|
||||||
long value = (Long) unspent.get("value");
|
long value = (Long) unspent.get("value");
|
||||||
|
|
||||||
unspentOutputs.add(new UnspentOutput(txHash, outputIndex, height, value));
|
unspentOutputs.add(new UnspentOutput(txHash, outputIndex, height, value));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user