mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
Add payment channel server native event handler wrappers
This commit is contained in:
parent
7074d52fbb
commit
146a6dd37e
@ -0,0 +1,20 @@
|
||||
package com.google.bitcoin.jni;
|
||||
|
||||
import com.google.bitcoin.protocols.channels.PaymentChannelServerListener;
|
||||
import com.google.bitcoin.protocols.channels.ServerConnectionEventHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
/**
|
||||
* An event listener that relays events to a native C++ object. A pointer to that object is stored in
|
||||
* this class using JNI on the native side, thus several instances of this can point to different actual
|
||||
* native implementations.
|
||||
*/
|
||||
public class NativePaymentChannelHandlerFactory implements PaymentChannelServerListener.HandlerFactory {
|
||||
public long ptr;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public native ServerConnectionEventHandler onNewConnection(SocketAddress clientAddress);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.google.bitcoin.jni;
|
||||
|
||||
import com.google.bitcoin.core.*;
|
||||
import com.google.bitcoin.protocols.channels.PaymentChannelCloseException;
|
||||
import com.google.bitcoin.protocols.channels.ServerConnectionEventHandler;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* An event listener that relays events to a native C++ object. A pointer to that object is stored in
|
||||
* this class using JNI on the native side, thus several instances of this can point to different actual
|
||||
* native implementations.
|
||||
*/
|
||||
public class NativePaymentChannelServerConnectionEventHandler extends ServerConnectionEventHandler {
|
||||
public long ptr;
|
||||
|
||||
@Override
|
||||
public native void channelOpen(Sha256Hash channelId);
|
||||
|
||||
@Override
|
||||
public native void paymentIncrease(BigInteger by, BigInteger to);
|
||||
|
||||
@Override
|
||||
public native void channelClosed(PaymentChannelCloseException.CloseReason reason);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user