From e2dc91c1eaf658110971c414785a6889e40e8e8c Mon Sep 17 00:00:00 2001 From: catbref Date: Wed, 29 Jul 2020 10:38:32 +0100 Subject: [PATCH] Fix API call DELETE /crosschain/tradeoffer regarding PoW MESSAGE reference --- .../org/qortal/api/resource/CrossChainResource.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/qortal/api/resource/CrossChainResource.java b/src/main/java/org/qortal/api/resource/CrossChainResource.java index 51c33990..4a3f45b3 100644 --- a/src/main/java/org/qortal/api/resource/CrossChainResource.java +++ b/src/main/java/org/qortal/api/resource/CrossChainResource.java @@ -13,6 +13,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Random; import java.util.function.Function; import java.util.function.ToIntFunction; @@ -1127,13 +1128,12 @@ public class CrossChainResource { } private byte[] buildAtMessage(Repository repository, byte[] senderPublicKey, String atAddress, byte[] messageData) throws DataException { - PublicKeyAccount creatorAccount = new PublicKeyAccount(repository, senderPublicKey); - + // senderPublicKey is actually ephemeral trade public key, so there is no corresponding account and hence no reference long txTimestamp = NTP.getTime(); - byte[] lastReference = creatorAccount.getLastReference(); - if (lastReference == null) - throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_REFERENCE); + Random random = new Random(); + byte[] lastReference = new byte[Transformer.SIGNATURE_LENGTH]; + random.nextBytes(lastReference); int version = 4; int nonce = 0;