mirror of
https://github.com/corda/corda.git
synced 2025-02-05 10:39:13 +00:00
CORDA-1588 - Add an extra check in the attachment resolution flow to prevent duplicate attachment import if multiple transactions with the same attachment are being resolved at the same time. (#3599)
This commit is contained in:
parent
c73647b4fe
commit
143379dad7
@ -147,7 +147,13 @@ class FetchAttachmentsFlow(requests: Set<SecureHash>,
|
||||
|
||||
override fun maybeWriteToDisk(downloaded: List<Attachment>) {
|
||||
for (attachment in downloaded) {
|
||||
serviceHub.attachments.importAttachment(attachment.open(), "$P2P_UPLOADER:${otherSideSession.counterparty.name}", null)
|
||||
with(serviceHub.attachments) {
|
||||
if (!hasAttachment(attachment.id)) {
|
||||
importAttachment(attachment.open(), "$P2P_UPLOADER:${otherSideSession.counterparty.name}", null)
|
||||
} else {
|
||||
logger.info("Attachment ${attachment.id} already exists, skipping.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user