mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-02 00:31:24 +00:00
Extract methods for creating and parsing payment requests, payment messages and payment acks, as well as Ack data class. Expose more payment request data from PaymentSession. Add unit tests for roundtripping all messages.
This commit is contained in:
committed by
Mike Hearn
parent
bd49cd4027
commit
cdfec498a4
@@ -23,6 +23,7 @@ import com.google.bitcoin.net.discovery.DnsDiscovery;
|
||||
import com.google.bitcoin.params.MainNetParams;
|
||||
import com.google.bitcoin.params.RegTestParams;
|
||||
import com.google.bitcoin.params.TestNet3Params;
|
||||
import com.google.bitcoin.protocols.payments.PaymentProtocol;
|
||||
import com.google.bitcoin.protocols.payments.PaymentProtocolException;
|
||||
import com.google.bitcoin.protocols.payments.PaymentSession;
|
||||
import com.google.bitcoin.store.*;
|
||||
@@ -557,14 +558,14 @@ public class WalletTool {
|
||||
}
|
||||
setup();
|
||||
// No refund address specified, no user-specified memo field.
|
||||
ListenableFuture<PaymentSession.Ack> future = session.sendPayment(ImmutableList.of(req.tx), null, null);
|
||||
ListenableFuture<PaymentProtocol.Ack> future = session.sendPayment(ImmutableList.of(req.tx), null, null);
|
||||
if (future == null) {
|
||||
// No payment_url for submission so, broadcast and wait.
|
||||
peers.startAsync();
|
||||
peers.awaitRunning();
|
||||
peers.broadcastTransaction(req.tx).get();
|
||||
} else {
|
||||
PaymentSession.Ack ack = future.get();
|
||||
PaymentProtocol.Ack ack = future.get();
|
||||
wallet.commitTx(req.tx);
|
||||
System.out.println("Memo from server: " + ack.getMemo());
|
||||
}
|
||||
|
Reference in New Issue
Block a user