Search in sources :

Example 11 with MobileCoinLedger

use of org.thoughtcrime.securesms.payments.proto.MobileCoinLedger in project Signal-Android by WhisperSystems.

the class LedgerReconcileTest method single_receipt_payment_that_can_be_found_on_ledger_reconstructed_spend_but_not_with_change_due_to_block.

@Test
public void single_receipt_payment_that_can_be_found_on_ledger_reconstructed_spend_but_not_with_change_due_to_block() {
    List<Payment> localPayments = Collections.singletonList(payment("received", mob(2.5), keyImages(6), publicKeys(2)));
    MobileCoinLedger ledger = ledger(spentTxo(mob(2.5), keyImage(5), publicKey(2), block(1), block(2)), unspentTxo(mob(1.5), keyImage(7), publicKey(8), block(3)));
    List<Payment> payments = reconcile(localPayments, new MobileCoinLedgerWrapper(ledger));
    assertEquals(Arrays.asList(mob(1.5), mob(-2.5), mob(2.5)), Stream.of(payments).map(Payment::getAmountWithDirection).toList());
    assertEquals("received", payments.get(2).getNote());
}
Also used : Payment(org.thoughtcrime.securesms.payments.Payment) MobileCoinLedger(org.thoughtcrime.securesms.payments.proto.MobileCoinLedger) MobileCoinLedgerWrapper(org.thoughtcrime.securesms.payments.MobileCoinLedgerWrapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 MobileCoinLedgerWrapper (org.thoughtcrime.securesms.payments.MobileCoinLedgerWrapper)11 Payment (org.thoughtcrime.securesms.payments.Payment)11 MobileCoinLedger (org.thoughtcrime.securesms.payments.proto.MobileCoinLedger)11