NioPeerHandler nio_peer_handler;
short nio_port;
final byte seed;
+ final byte[] key_seed = new byte[32];
final Logger logger;
final FeeEstimator fee_estimator;
final BroadcasterInterface tx_broadcaster;
chain_watch = chain_monitor.as_Watch();
}
- byte[] key_seed = new byte[32];
for (byte i = 0; i < 32; i++) {
key_seed[i] = (byte) (i ^ seed);
}
String description_string = raw_invoice_description.into_inner();
assert description_string.equals("Invoice Description");
+ // Do a trivial test of constructing a phantom invoice
+ Result_InvoiceSignOrCreationErrorZ phantom_invoice = UtilMethods.create_phantom_invoice(
+ Option_u64Z.some(42000),
+ new byte[32], // TODO: This needs to be an option/null, not interpreting all-0s as None
+ "Phantom Invoice", 7200,
+ new PhantomRouteHints[]{ peer2.chan_manager.get_phantom_route_hints() },
+ peer2.entropy_source,
+ PhantomKeysManager.of(peer2.key_seed, 42, 42, new byte[32]).as_NodeSigner(),
+ peer2.logger, Currency.LDKCurrency_Bitcoin, Option_u16Z.none(),
+ System.currentTimeMillis() / 1000);
+ assert phantom_invoice.is_ok();
+ RouteHint[] hints = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK)phantom_invoice).res.route_hints();
+ assert hints.length == 1;
+ RouteHintHop[] val = hints[0].get_a();
+ assert hints[0].get_a().length == 1; // Our one channel is public so we should just have a single-hop hint
+
if (!use_invoice_payer) {
byte[] payment_hash = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK) invoice).res.payment_hash();
byte[] payment_secret = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK) invoice).res.payment_secret();