forked from Qortal/qortal
Added PresenceTestTransaction, to allow SerializationTests.testTransactions() to be unblocked
This commit is contained in:
parent
6f07dc7852
commit
fe79119809
@ -38,7 +38,6 @@ public class SerializationTests extends Common {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore(value = "Doesn't work, to be fixed later")
|
||||
public void testTransactions() throws DataException, TransformationException {
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
PrivateKeyAccount signingAccount = Common.getTestAccount(repository, "alice");
|
||||
|
@ -0,0 +1,25 @@
|
||||
package org.qortal.test.common.transaction;
|
||||
|
||||
import com.google.common.primitives.Longs;
|
||||
import org.qortal.account.PrivateKeyAccount;
|
||||
import org.qortal.data.transaction.PresenceTransactionData;
|
||||
import org.qortal.data.transaction.TransactionData;
|
||||
import org.qortal.repository.DataException;
|
||||
import org.qortal.repository.Repository;
|
||||
import org.qortal.transaction.PresenceTransaction.PresenceType;
|
||||
import org.qortal.utils.NTP;
|
||||
|
||||
public class PresenceTestTransaction extends TestTransaction {
|
||||
|
||||
public static TransactionData randomTransaction(Repository repository, PrivateKeyAccount account, boolean wantValid) throws DataException {
|
||||
final int nonce = 0;
|
||||
|
||||
byte[] tradePrivateKey = new byte[32];
|
||||
PrivateKeyAccount tradeNativeAccount = new PrivateKeyAccount(repository, tradePrivateKey);
|
||||
long timestamp = NTP.getTime();
|
||||
byte[] timestampSignature = tradeNativeAccount.sign(Longs.toByteArray(timestamp));
|
||||
|
||||
return new PresenceTransactionData(generateBase(account), nonce, PresenceType.TRADE_BOT, timestampSignature);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user