Java Code Examples for org.bitcoinj.core.Context#getOrCreate()

The following examples show how to use org.bitcoinj.core.Context#getOrCreate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LNPaymentLogicImplTest.java    From thunder with GNU Affero General Public License v3.0 5 votes vote down vote up
@Before
    public void prepare () {
        Context.getOrCreate(Constants.getNetwork());

        node1 = new ClientObject();
        node2 = new ClientObject();

        node1.isServer = false;
        node2.isServer = true;

        node1.name = "LNPayment1";
        node2.name = "LNPayment2";

        messageFactory1 = new LNPaymentMessageFactoryImpl(dbHandler1);
        messageFactory2 = new LNPaymentMessageFactoryImpl(dbHandler2);

        channel1 = getMockChannel();
        channel2 = getMockChannel();

//        channel1.channelStatus.applyConfiguration(configuration);
//        channel2.channelStatus.applyConfiguration(configuration);

        channel1.retrieveDataFromOtherChannel(channel2);
        channel2.retrieveDataFromOtherChannel(channel1);

        paymentLogic1 = new LNPaymentLogicImpl(messageFactory1, dbHandler1);
        paymentLogic2 = new LNPaymentLogicImpl(messageFactory2, dbHandler2);

        paymentLogic1.initialise(channel1);
        paymentLogic2.initialise(channel2);
    }
 
Example 2
Source File: LNPaymentLogicImplTest.java    From thundernetwork with GNU Affero General Public License v3.0 5 votes vote down vote up
@Before
public void prepare () {
    Context.getOrCreate(Constants.getNetwork());

    node1 = new NodeClient();
    node2 = new NodeClient();

    node1.isServer = false;
    node2.isServer = true;

    node1.name = "LNPayment1";
    node2.name = "LNPayment2";

    messageFactory1 = new LNPaymentMessageFactoryImpl(dbHandler1);
    messageFactory2 = new LNPaymentMessageFactoryImpl(dbHandler2);

    channel1 = new Channel();
    channel2 = new Channel();

    channel1.channelStatus.applyConfiguration(configuration);
    channel2.channelStatus.applyConfiguration(configuration);

    channel1.retrieveDataFromOtherChannel(channel2);
    channel2.retrieveDataFromOtherChannel(channel1);

    paymentLogic1 = new LNPaymentLogicImpl(messageFactory1, dbHandler1);
    paymentLogic2 = new LNPaymentLogicImpl(messageFactory2, dbHandler2);

    paymentLogic1.initialise(channel1);
    paymentLogic2.initialise(channel2);
}