mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 13:16:44 +00:00
cormorant: fix initialisation of sent txes without txindex
This commit is contained in:
parent
9edeff9aab
commit
057a9efb1f
1 changed files with 9 additions and 1 deletions
|
@ -387,7 +387,7 @@ public class BitcoindClient {
|
||||||
|
|
||||||
for(ListTransaction sentTransaction : sentTransactions) {
|
for(ListTransaction sentTransaction : sentTransactions) {
|
||||||
Set<HashIndex> spentOutputs = store.getSpentOutputs().computeIfAbsent(sentTransaction.txid(), txid -> {
|
Set<HashIndex> spentOutputs = store.getSpentOutputs().computeIfAbsent(sentTransaction.txid(), txid -> {
|
||||||
String txhex = getBitcoindService().getRawTransaction(txid, false).toString();
|
String txhex = getTransaction(txid);
|
||||||
Transaction tx = new Transaction(Utils.hexToBytes(txhex));
|
Transaction tx = new Transaction(Utils.hexToBytes(txhex));
|
||||||
return tx.getInputs().stream().map(txInput -> new HashIndex(txInput.getOutpoint().getHash(), txInput.getOutpoint().getIndex())).collect(Collectors.toSet());
|
return tx.getInputs().stream().map(txInput -> new HashIndex(txInput.getOutpoint().getHash(), txInput.getOutpoint().getIndex())).collect(Collectors.toSet());
|
||||||
});
|
});
|
||||||
|
@ -419,6 +419,14 @@ public class BitcoindClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTransaction(String txid) {
|
||||||
|
try {
|
||||||
|
return getBitcoindService().getTransaction(txid, false).get("hex").toString();
|
||||||
|
} catch(JsonRpcException e) {
|
||||||
|
return getBitcoindService().getRawTransaction(txid, false).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void syncMempool(boolean forceRefresh) {
|
private void syncMempool(boolean forceRefresh) {
|
||||||
Map<String, MempoolEntry> mempoolEntries = store.getMempoolEntries();
|
Map<String, MempoolEntry> mempoolEntries = store.getMempoolEntries();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue