QDN bug resolution

This commit is contained in:
kennycud 2025-03-21 18:44:41 -07:00
parent a893888a2e
commit d0a85d4717

View File

@ -308,7 +308,13 @@ public class ArbitraryTransaction extends Transaction {
// Add/update arbitrary resource caches, but don't update the status as this involves time-consuming
// disk reads, and is more prone to failure. The status will be updated on metadata retrieval, or when
// accessing the resource.
this.updateArbitraryResourceCacheIncludingMetadata(repository, new HashSet<>(0), new HashMap<>(0));
// Also, must add this transaction as a latest transaction, since the it has not been saved to the
// repository yet.
this.updateArbitraryResourceCacheIncludingMetadata(
repository,
Set.of(new ArbitraryTransactionDataHashWrapper(arbitraryTransactionData)),
new HashMap<>(0)
);
repository.saveChanges();
@ -329,6 +335,19 @@ public class ArbitraryTransaction extends Transaction {
public void orphan() throws DataException {
// Wrap and delegate payment processing to Payment class.
new Payment(this.repository).orphan(arbitraryTransactionData.getSenderPublicKey(), arbitraryTransactionData.getPayments());
try {
ArbitraryResourceData arbitraryResourceData = new ArbitraryResourceData();
arbitraryResourceData.service = this.arbitraryTransactionData.getService();
arbitraryResourceData.name = this.arbitraryTransactionData.getName();
arbitraryResourceData.identifier = this.arbitraryTransactionData.getIdentifier();
this.repository.getArbitraryRepository().delete(arbitraryResourceData);
} catch (DataException e) {
throw e;
} catch (Exception e ) { // if anything is wrong with the code above, we need to know
LOGGER.error(e.getMessage(), e);
}
}
@Override
@ -443,9 +462,13 @@ public class ArbitraryTransaction extends Transaction {
arbitraryResourceData.size = latestTransactionData.getSize();
LOGGER.info("saving to arbitrary resource cache: " + arbitraryResourceData);
// Save
repository.getArbitraryRepository().save(arbitraryResourceData);
LOGGER.info("saved to arbitrary resource cache: " + arbitraryResourceData);
// Update metadata for latest transaction if it is local
if (latestTransactionData.getMetadataHash() != null) {
ArbitraryDataFile metadataFile = ArbitraryDataFile.fromHash(latestTransactionData.getMetadataHash(), latestTransactionData.getSignature());