forked from Qortal/qortal
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) {
|
||||
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();
|
||||
int outputIndex = ((Long) unspent.get("tx_pos")).intValue();
|
||||
int height = ((Long) unspent.get("height")).intValue();
|
||||
long value = (Long) unspent.get("value");
|
||||
|
||||
unspentOutputs.add(new UnspentOutput(txHash, outputIndex, height, value));
|
||||
|
Loading…
Reference in New Issue
Block a user