Fixed tests & bugs, removed Ack payload type (a GenericPayload is now used)

- SystemTest don't work yet, sending messages seems broken
- ProofOfWorkService needs some work, the current solution is a hack (and might be the reason above tests are broken)
This commit is contained in:
2016-05-02 11:11:29 +02:00
parent ea2cd7bf53
commit c7594795f0
18 changed files with 124 additions and 57 deletions

View File

@ -175,10 +175,13 @@ public class InternalContext {
object.sign(from.getPrivateKey());
}
if (payload instanceof Msg && recipient.has(Pubkey.Feature.DOES_ACK)) {
ObjectMessage ackMessage = ((Msg) payload).getPlaintext().getAckMessage();
final ObjectMessage ackMessage = ((Msg) payload).getPlaintext().getAckMessage();
cryptography.doProofOfWork(ackMessage, NETWORK_NONCE_TRIALS_PER_BYTE, NETWORK_EXTRA_BYTES, new ProofOfWorkEngine.Callback() {
@Override
public void onNonceCalculated(byte[] initialHash, byte[] nonce) {
// FIXME: the message gets lost if calculation is cancelled
// (e.g. by terminating the application)
ackMessage.setNonce(nonce);
object.encrypt(recipient.getPubkey());
proofOfWorkService.doProofOfWork(recipient, object);
}