forked from Qortal/qortal
Refactor post-importAsUnconfirmed as method to be overridden by Transaction subclasses, e.g. CHAT
This commit is contained in:
parent
9b7c2c50fb
commit
90b993e234
@ -188,6 +188,16 @@ public class ChatTransaction extends Transaction {
|
|||||||
return MemoryPoW.verify2(transactionBytes, POW_BUFFER_SIZE, difficulty, nonce);
|
return MemoryPoW.verify2(transactionBytes, POW_BUFFER_SIZE, difficulty, nonce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure there's at least a skeleton account so people
|
||||||
|
* can retrieve sender's public key using address, even if all their messages
|
||||||
|
* expire.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onImportAsUnconfirmed() throws DataException {
|
||||||
|
this.getCreator().ensureAccount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() throws DataException {
|
public void process() throws DataException {
|
||||||
throw new DataException("CHAT transactions should never be processed");
|
throw new DataException("CHAT transactions should never be processed");
|
||||||
|
@ -800,13 +800,7 @@ public abstract class Transaction {
|
|||||||
repository.getTransactionRepository().save(transactionData);
|
repository.getTransactionRepository().save(transactionData);
|
||||||
repository.getTransactionRepository().unconfirmTransaction(transactionData);
|
repository.getTransactionRepository().unconfirmTransaction(transactionData);
|
||||||
|
|
||||||
/*
|
this.onImportAsUnconfirmed();
|
||||||
* If CHAT transaction then ensure there's at least a skeleton account so people
|
|
||||||
* can retrieve sender's public key using address, even if all their messages
|
|
||||||
* expire.
|
|
||||||
*/
|
|
||||||
if (transactionData.getType() == TransactionType.CHAT)
|
|
||||||
this.getCreator().ensureAccount();
|
|
||||||
|
|
||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
|
|
||||||
@ -816,6 +810,17 @@ public abstract class Transaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for when a transaction is imported as unconfirmed.
|
||||||
|
* <p>
|
||||||
|
* Called after transaction is added to repository, but before commit.
|
||||||
|
* <p>
|
||||||
|
* Blockchain lock is being held during this time.
|
||||||
|
*/
|
||||||
|
protected void onImportAsUnconfirmed() throws DataException {
|
||||||
|
/* To be optionally overridden */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether transaction can be added to the blockchain.
|
* Returns whether transaction can be added to the blockchain.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user