1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 14:22:39 +01:00

project-wide auto-reformatting

This commit is contained in:
pm47 2016-12-07 12:52:59 +01:00
parent 81739cb0e6
commit 3bfe7292c4
48 changed files with 612 additions and 528 deletions

View file

@ -6,25 +6,21 @@ public class Poly3105 {
static final int[] minusp = {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252};
static void add(int[] h, int[] c)
{
static void add(int[] h, int[] c) {
int j;
int u = 0;
for (j = 0; j < 17; ++j)
{
for (j = 0; j < 17; ++j) {
u += h[j] + c[j];
h[j] = u & 255;
u >>>= 8;
}
}
static void squeeze(int[] h)
{
static void squeeze(int[] h) {
int u = 0;
for (int j = 0; j < 16; ++j)
{
for (int j = 0; j < 16; ++j) {
u += h[j];
h[j] = u & 255;
u >>>= 8;
@ -34,8 +30,7 @@ public class Poly3105 {
h[16] = u & 3;
u = 5 * (u >>> 2);
for (int j = 0; j < 16; ++j)
{
for (int j = 0; j < 16; ++j) {
u += h[j];
h[j] = u & 255;
u >>>= 8;
@ -45,8 +40,7 @@ public class Poly3105 {
h[16] = u;
}
static void freeze(int[] h)
{
static void freeze(int[] h) {
int[] horig = new int[17];
for (int j = 0; j < 17; ++j)
@ -54,18 +48,16 @@ public class Poly3105 {
add(h, minusp);
int negative = (int)(-(h[16] >>> 7));
int negative = (int) (-(h[16] >>> 7));
for (int j = 0; j < 17; ++j)
h[j] ^= negative & (horig[j] ^ h[j]);
}
static void mulmod(int[] h, int[] r)
{
static void mulmod(int[] h, int[] r) {
int[] hr = new int[17];
for (int i = 0; i < 17; ++i)
{
for (int i = 0; i < 17; ++i) {
int u = 0;
for (int j = 0; j <= i; ++j)
@ -83,8 +75,7 @@ public class Poly3105 {
squeeze(h);
}
public static int crypto_onetimeauth(byte[] outv, int outvoffset, byte[] inv, int invoffset, long inlen, byte[] k)
{
public static int crypto_onetimeauth(byte[] outv, int outvoffset, byte[] inv, int invoffset, long inlen, byte[] k) {
int j;
int[] r = new int[17];
int[] h = new int[17];
@ -111,13 +102,12 @@ public class Poly3105 {
for (j = 0; j < 17; ++j)
h[j] = 0;
while (inlen > 0)
{
while (inlen > 0) {
for (j = 0; j < 17; ++j)
c[j] = 0;
for (j = 0; (j < 16) && (j < inlen); ++j)
c[j] = inv[invoffset + j]&0xff;
c[j] = inv[invoffset + j] & 0xff;
c[j] = 1;
invoffset += j;
@ -135,7 +125,7 @@ public class Poly3105 {
add(h, c);
for (j = 0; j < 16; ++j)
outv[j + outvoffset] = (byte)h[j];
outv[j + outvoffset] = (byte) h[j];
return 0;
}

View file

@ -4,44 +4,50 @@
<?import javafx.scene.layout.*?>
<?import java.net.URL?>
<VBox styleClass="channel" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<children>
<GridPane maxWidth="1.7976931348623157E308" styleClass="grid">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="10.0" prefWidth="125.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="114.0" minWidth="10.0" prefWidth="114.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="70.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="8.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label styleClass="text-muted" text="Node id" GridPane.rowIndex="2" />
<Label styleClass="text-muted" text="Capacity (millibits)" GridPane.rowIndex="4" />
<Label styleClass="text-muted" text="Funder" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<Label styleClass="text-muted" text="State" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<Button fx:id="close" mnemonicParsing="false" styleClass="close-channel" text="Close" GridPane.columnIndex="4" GridPane.halignment="RIGHT" />
<Label fx:id="nodeId" onContextMenuRequested="#handleTheirNodeIdContext" text="N/A" GridPane.columnIndex="1" GridPane.columnSpan="4" GridPane.rowIndex="2" />
<Label fx:id="capacity" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label fx:id="funder" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2" GridPane.rowIndex="3" />
<Label fx:id="state" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2" GridPane.rowIndex="4" />
<Label fx:id="channelId" onContextMenuRequested="#handleChannelIdContext" styleClass="text-strong" text="N/A" GridPane.columnSpan="4" />
<Label fx:id="amountUs" prefWidth="100.0" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<ProgressBar fx:id="balanceBar" maxWidth="1.7976931348623157E308" minHeight="5.0" prefHeight="8.0" prefWidth="1045.0" progress="0.0" snapToPixel="false" GridPane.columnSpan="5" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" />
<Label styleClass="text-muted" text="Your balance (millibits)" GridPane.rowIndex="3" />
</children>
</GridPane>
<HBox styleClass="channel-separator" />
</children>
<stylesheets>
<URL value="@../commons/globals.css" />
<URL value="@../commons/form.css" />
<URL value="@../commons/progressbar.css" />
<URL value="@channel.css" />
</stylesheets>
<children>
<GridPane maxWidth="1.7976931348623157E308" styleClass="grid">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="125.0" minWidth="10.0" prefWidth="125.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="114.0" minWidth="10.0" prefWidth="114.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="95.0" minWidth="10.0" prefWidth="70.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="8.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label styleClass="text-muted" text="Node id" GridPane.rowIndex="2"/>
<Label styleClass="text-muted" text="Capacity (millibits)" GridPane.rowIndex="4"/>
<Label styleClass="text-muted" text="Funder" GridPane.columnIndex="2" GridPane.rowIndex="3"/>
<Label styleClass="text-muted" text="State" GridPane.columnIndex="2" GridPane.rowIndex="4"/>
<Button fx:id="close" mnemonicParsing="false" styleClass="close-channel" text="Close"
GridPane.columnIndex="4" GridPane.halignment="RIGHT"/>
<Label fx:id="nodeId" onContextMenuRequested="#handleTheirNodeIdContext" text="N/A"
GridPane.columnIndex="1" GridPane.columnSpan="4" GridPane.rowIndex="2"/>
<Label fx:id="capacity" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label fx:id="funder" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2"
GridPane.rowIndex="3"/>
<Label fx:id="state" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2" GridPane.rowIndex="4"/>
<Label fx:id="channelId" onContextMenuRequested="#handleChannelIdContext" styleClass="text-strong"
text="N/A" GridPane.columnSpan="4"/>
<Label fx:id="amountUs" prefWidth="100.0" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<ProgressBar fx:id="balanceBar" maxWidth="1.7976931348623157E308" minHeight="5.0" prefHeight="8.0"
prefWidth="1045.0" progress="0.0" snapToPixel="false" GridPane.columnSpan="5"
GridPane.hgrow="ALWAYS" GridPane.rowIndex="1"/>
<Label styleClass="text-muted" text="Your balance (millibits)" GridPane.rowIndex="3"/>
</children>
</GridPane>
<HBox styleClass="channel-separator"/>
</children>
<stylesheets>
<URL value="@../commons/globals.css"/>
<URL value="@../commons/form.css"/>
<URL value="@../commons/progressbar.css"/>
<URL value="@channel.css"/>
</stylesheets>
</VBox>

View file

@ -6,118 +6,127 @@
<?import javafx.scene.layout.*?>
<?import java.lang.String?>
<?import java.net.URL?>
<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="346.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<center>
<TabPane prefHeight="250.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
<tabs>
<Tab closable="false" text="Channels">
<content>
<StackPane>
<children>
<ScrollPane fitToWidth="true" styleClass="channel-container">
<content>
<VBox fx:id="channelBox" />
</content>
</ScrollPane>
<VBox fx:id="channelInfo" alignment="TOP_CENTER" styleClass="channels-info">
<children>
<Label styleClass="text-strong" text="No channels opened yet..." />
<Label styleClass="text-muted" text="You can open a new channel by clicking on &quot;Channels&quot; &gt; &quot;Open Channel...&quot;" wrapText="true" />
</children>
</VBox>
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="graphTab" closable="false" text="Graph">
<content>
<Label text="Label" />
</content></Tab>
</tabs>
</TabPane>
</center>
<bottom>
<GridPane styleClass="status-bar" BorderPane.alignment="CENTER_LEFT">
<columnConstraints>
<ColumnConstraints fillWidth="false" hgrow="SOMETIMES" minWidth="10.0" />
<ColumnConstraints hgrow="ALWAYS" minWidth="400.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<HBox alignment="CENTER_LEFT">
<children>
<ImageView fitHeight="16.0" fitWidth="27.0" opacity="0.52" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../commons/images/eclair-shape.png" />
</image>
</ImageView>
<Label fx:id="labelNodeId" onContextMenuRequested="#handleNodeIdContext" text="N/A" />
</children>
</HBox>
<HBox alignment="CENTER_RIGHT" GridPane.columnIndex="1">
<children>
<HBox alignment="CENTER_RIGHT" minWidth="80.0">
<children>
<Separator orientation="VERTICAL" />
<Label text="HTTP">
<styleClass>
<String fx:value="badge" />
<String fx:value="badge-http" />
</styleClass>
</Label>
<Label fx:id="labelApi" styleClass="value" text="00000" textAlignment="RIGHT" />
</children>
</HBox>
<HBox alignment="CENTER_RIGHT" minWidth="80.0">
<children>
<Separator orientation="VERTICAL" />
<Label text="TCP">
<styleClass>
<String fx:value="badge" />
<String fx:value="badge-tcp" />
</styleClass>
</Label>
<Label fx:id="labelServer" text="000000" textAlignment="RIGHT" />
</children>
</HBox>
<HBox alignment="CENTER_RIGHT">
<children>
<Separator orientation="VERTICAL" />
<Label text="Bitcoin-core" textAlignment="RIGHT" />
<Label fx:id="bitcoinVersion" text="N/A" />
<Label fx:id="bitcoinChain" styleClass="chain" text="(N/A)" />
</children>
</HBox>
</children>
</HBox>
</children>
</GridPane>
</bottom>
<stylesheets>
<URL value="@main.css" />
<URL value="@../commons/globals.css" />
</stylesheets>
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="Channels">
<items>
<MenuItem fx:id="menuOpen" mnemonicParsing="false" onAction="#handleOpenChannel" text="Open channel..." />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem fx:id="menuSend" mnemonicParsing="false" onAction="#handleSendPayment" text="Send Payment..." />
<MenuItem fx:id="menuReceive" mnemonicParsing="false" onAction="#handleReceivePayment" text="Receive Payment..." />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" onAction="#handleCloseRequest" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" onAction="#handleOpenAbout" text="About Eclair..." />
</items>
</Menu>
</menus>
</MenuBar>
</top>
<BorderPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefHeight="346.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/8.0.60"
xmlns:fx="http://javafx.com/fxml/1">
<center>
<TabPane prefHeight="250.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
<tabs>
<Tab closable="false" text="Channels">
<content>
<StackPane>
<children>
<ScrollPane fitToWidth="true" styleClass="channel-container">
<content>
<VBox fx:id="channelBox"/>
</content>
</ScrollPane>
<VBox fx:id="channelInfo" alignment="TOP_CENTER" styleClass="channels-info">
<children>
<Label styleClass="text-strong" text="No channels opened yet..."/>
<Label styleClass="text-muted"
text="You can open a new channel by clicking on &quot;Channels&quot; &gt; &quot;Open Channel...&quot;"
wrapText="true"/>
</children>
</VBox>
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="graphTab" closable="false" text="Graph">
<content>
<Label text="Label"/>
</content>
</Tab>
</tabs>
</TabPane>
</center>
<bottom>
<GridPane styleClass="status-bar" BorderPane.alignment="CENTER_LEFT">
<columnConstraints>
<ColumnConstraints fillWidth="false" hgrow="SOMETIMES" minWidth="10.0"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="400.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<HBox alignment="CENTER_LEFT">
<children>
<ImageView fitHeight="16.0" fitWidth="27.0" opacity="0.52" pickOnBounds="true"
preserveRatio="true">
<image>
<Image url="@../commons/images/eclair-shape.png"/>
</image>
</ImageView>
<Label fx:id="labelNodeId" onContextMenuRequested="#handleNodeIdContext" text="N/A"/>
</children>
</HBox>
<HBox alignment="CENTER_RIGHT" GridPane.columnIndex="1">
<children>
<HBox alignment="CENTER_RIGHT" minWidth="80.0">
<children>
<Separator orientation="VERTICAL"/>
<Label text="HTTP">
<styleClass>
<String fx:value="badge"/>
<String fx:value="badge-http"/>
</styleClass>
</Label>
<Label fx:id="labelApi" styleClass="value" text="00000" textAlignment="RIGHT"/>
</children>
</HBox>
<HBox alignment="CENTER_RIGHT" minWidth="80.0">
<children>
<Separator orientation="VERTICAL"/>
<Label text="TCP">
<styleClass>
<String fx:value="badge"/>
<String fx:value="badge-tcp"/>
</styleClass>
</Label>
<Label fx:id="labelServer" text="000000" textAlignment="RIGHT"/>
</children>
</HBox>
<HBox alignment="CENTER_RIGHT">
<children>
<Separator orientation="VERTICAL"/>
<Label text="Bitcoin-core" textAlignment="RIGHT"/>
<Label fx:id="bitcoinVersion" text="N/A"/>
<Label fx:id="bitcoinChain" styleClass="chain" text="(N/A)"/>
</children>
</HBox>
</children>
</HBox>
</children>
</GridPane>
</bottom>
<stylesheets>
<URL value="@main.css"/>
<URL value="@../commons/globals.css"/>
</stylesheets>
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="Channels">
<items>
<MenuItem fx:id="menuOpen" mnemonicParsing="false" onAction="#handleOpenChannel"
text="Open channel..."/>
<SeparatorMenuItem mnemonicParsing="false"/>
<MenuItem fx:id="menuSend" mnemonicParsing="false" onAction="#handleSendPayment"
text="Send Payment..."/>
<MenuItem fx:id="menuReceive" mnemonicParsing="false" onAction="#handleReceivePayment"
text="Receive Payment..."/>
<SeparatorMenuItem mnemonicParsing="false"/>
<MenuItem mnemonicParsing="false" onAction="#handleCloseRequest" text="Close"/>
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" onAction="#handleOpenAbout" text="About Eclair..."/>
</items>
</Menu>
</menus>
</MenuBar>
</top>
</BorderPane>

View file

@ -6,56 +6,61 @@
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.net.URL?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" />
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" />
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<VBox fillWidth="false" styleClass="about-content" GridPane.columnIndex="1" GridPane.columnSpan="2">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Eclair">
<styleClass>
<String fx:value="about-text" />
<String fx:value="text-strong" />
</styleClass>
</Text>
<TextFlow />
<TextFlow>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text" text="This software is brought to you by ACINQ :-)" />
</children>
</TextFlow>
<TextFlow>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text" text="The source code is available on GitHub (https://github.com/ACINQ/eclair)" />
</children>
</TextFlow>
<TextFlow layoutX="10.0" layoutY="90.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text" text="This software is released under the Apache 2 License (http://www.apache.org/licenses/)" />
</children>
</TextFlow>
</children>
</VBox>
<ImageView fitHeight="120.0" fitWidth="120.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER">
<image>
<Image url="@../commons/images/eclair02.png" />
</image>
</ImageView>
</children>
<styleClass>
<String fx:value="grid" />
<String fx:value="modal" />
<String fx:value="about" />
</styleClass>
<stylesheets>
<URL value="@../commons/form.css" />
<URL value="@../commons/globals.css" />
<URL value="@modals.css" />
</stylesheets>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0"/>
<ColumnConstraints/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<VBox fillWidth="false" styleClass="about-content" GridPane.columnIndex="1" GridPane.columnSpan="2">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Eclair">
<styleClass>
<String fx:value="about-text"/>
<String fx:value="text-strong"/>
</styleClass>
</Text>
<TextFlow/>
<TextFlow>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text"
text="This software is brought to you by ACINQ :-)"/>
</children>
</TextFlow>
<TextFlow>
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text"
text="The source code is available on GitHub (https://github.com/ACINQ/eclair)"/>
</children>
</TextFlow>
<TextFlow layoutX="10.0" layoutY="90.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" styleClass="about-text"
text="This software is released under the Apache 2 License (http://www.apache.org/licenses/)"/>
</children>
</TextFlow>
</children>
</VBox>
<ImageView fitHeight="120.0" fitWidth="120.0" pickOnBounds="true" preserveRatio="true"
GridPane.halignment="CENTER">
<image>
<Image url="@../commons/images/eclair02.png"/>
</image>
</ImageView>
</children>
<styleClass>
<String fx:value="grid"/>
<String fx:value="modal"/>
<String fx:value="about"/>
</styleClass>
<stylesheets>
<URL value="@../commons/form.css"/>
<URL value="@../commons/globals.css"/>
<URL value="@modals.css"/>
</stylesheets>
</GridPane>

View file

@ -5,41 +5,48 @@
<?import javafx.scene.layout.*?>
<?import java.lang.String?>
<?import java.net.URL?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="528.0" styleClass="grid" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="258.0" minWidth="10.0" prefWidth="157.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="263.0" minWidth="10.0" prefWidth="176.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="171.0" minWidth="10.0" prefWidth="145.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="50.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<TextField fx:id="host" prefWidth="313.0" promptText="host:port" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1" />
<TextField fx:id="amount" prefHeight="31.0" prefWidth="123.0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<ComboBox fx:id="unit" prefWidth="150.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:id="milliBTC" fx:value="milliBTC" />
<String fx:id="Satoshi" fx:value="Satoshi" />
<String fx:id="milliSatoshi" fx:value="milliSatoshi" />
</FXCollections>
</items>
</ComboBox>
<Button fx:id="button" defaultButton="true" mnemonicParsing="false" onAction="#handleOpen" text="Connect" GridPane.columnIndex="1" GridPane.rowIndex="4" GridPane.valignment="BOTTOM" />
<Label text="Target Node URL" GridPane.rowIndex="1" />
<Label text="Amount" GridPane.rowIndex="3" />
<Label fx:id="hostError" opacity="0.0" styleClass="text-error" text="Please use a valid url (host:port)" GridPane.columnIndex="1" GridPane.columnSpan="2" />
<Label fx:id="amountError" opacity="0.0" styleClass="text-error" text="Please use a valid amount" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="2" />
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="4" GridPane.valignment="BOTTOM" />
</children>
<stylesheets>
<URL value="@modals.css" />
<URL value="@../commons/form.css" />
<URL value="@../commons/globals.css" />
</stylesheets>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="528.0"
styleClass="grid" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="258.0" minWidth="10.0" prefWidth="157.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="263.0" minWidth="10.0" prefWidth="176.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="171.0" minWidth="10.0" prefWidth="145.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES"/>
<RowConstraints vgrow="SOMETIMES"/>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES"/>
<RowConstraints vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="50.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<TextField fx:id="host" prefWidth="313.0" promptText="host:port" GridPane.columnIndex="1"
GridPane.columnSpan="2" GridPane.rowIndex="1"/>
<TextField fx:id="amount" prefHeight="31.0" prefWidth="123.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<ComboBox fx:id="unit" prefWidth="150.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:id="milliBTC" fx:value="milliBTC"/>
<String fx:id="Satoshi" fx:value="Satoshi"/>
<String fx:id="milliSatoshi" fx:value="milliSatoshi"/>
</FXCollections>
</items>
</ComboBox>
<Button fx:id="button" defaultButton="true" mnemonicParsing="false" onAction="#handleOpen" text="Connect"
GridPane.columnIndex="1" GridPane.rowIndex="4" GridPane.valignment="BOTTOM"/>
<Label text="Target Node URL" GridPane.rowIndex="1"/>
<Label text="Amount" GridPane.rowIndex="3"/>
<Label fx:id="hostError" opacity="0.0" styleClass="text-error" text="Please use a valid url (host:port)"
GridPane.columnIndex="1" GridPane.columnSpan="2"/>
<Label fx:id="amountError" opacity="0.0" styleClass="text-error" text="Please use a valid amount"
GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="2"/>
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel"
GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="4"
GridPane.valignment="BOTTOM"/>
</children>
<stylesheets>
<URL value="@modals.css"/>
<URL value="@../commons/form.css"/>
<URL value="@../commons/globals.css"/>
</stylesheets>
</GridPane>

View file

@ -4,31 +4,38 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Text?>
<?import java.net.URL?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" styleClass="grid" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="274.0" minWidth="10.0" prefWidth="242.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints fillHeight="false" minHeight="0.0" prefHeight="1.0" valignment="CENTER" vgrow="ALWAYS" />
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="ALWAYS" />
</rowConstraints>
<children>
<Label text="Amount (mSat)" GridPane.rowIndex="1" />
<TextField fx:id="amount" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1" />
<Button defaultButton="true" mnemonicParsing="false" onAction="#handleGenerate" prefHeight="29.0" prefWidth="89.0" text="Generate" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<TextArea fx:id="paymentRequest" editable="false" prefHeight="150.0" prefWidth="275.0" styleClass="ta" wrapText="true" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4" />
<Separator prefHeight="1.0" GridPane.columnSpan="3" GridPane.rowIndex="3" />
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Copy the generated Payment Request and send it to the person owing you the amount above" textAlignment="RIGHT" wrappingWidth="188.9560546875" GridPane.rowIndex="4" />
<Label fx:id="amountError" opacity="0.0" styleClass="text-error" text="Please use a valid payment request" GridPane.columnIndex="1" />
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
</children>
<stylesheets>
<URL value="@../commons/globals.css" />
<URL value="@../commons/form.css" />
</stylesheets>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" styleClass="grid"
xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="274.0" minWidth="10.0" prefWidth="242.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints fillHeight="false" minHeight="0.0" prefHeight="1.0" valignment="CENTER" vgrow="ALWAYS"/>
<RowConstraints minHeight="10.0" valignment="TOP" vgrow="ALWAYS"/>
</rowConstraints>
<children>
<Label text="Amount (mSat)" GridPane.rowIndex="1"/>
<TextField fx:id="amount" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="1"/>
<Button defaultButton="true" mnemonicParsing="false" onAction="#handleGenerate" prefHeight="29.0"
prefWidth="89.0" text="Generate" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<TextArea fx:id="paymentRequest" editable="false" prefHeight="150.0" prefWidth="275.0" styleClass="ta"
wrapText="true" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4"/>
<Separator prefHeight="1.0" GridPane.columnSpan="3" GridPane.rowIndex="3"/>
<Text strokeType="OUTSIDE" strokeWidth="0.0"
text="Copy the generated Payment Request and send it to the person owing you the amount above"
textAlignment="RIGHT" wrappingWidth="188.9560546875" GridPane.rowIndex="4"/>
<Label fx:id="amountError" opacity="0.0" styleClass="text-error" text="Please use a valid payment request"
GridPane.columnIndex="1"/>
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel"
GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/>
</children>
<stylesheets>
<URL value="@../commons/globals.css"/>
<URL value="@../commons/form.css"/>
</stylesheets>
</GridPane>

View file

@ -4,46 +4,53 @@
<?import javafx.scene.layout.*?>
<?import java.lang.String?>
<?import java.net.URL?>
<GridPane fx:id="nodeId" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefWidth="395.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0" />
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" maxWidth="292.0" minWidth="10.0" prefWidth="241.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="1.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label styleClass="text-strong" text="Enter a Payment Request below" GridPane.columnSpan="2" GridPane.valignment="TOP" />
<TextArea fx:id="paymentRequest" minHeight="150.0" prefHeight="150.0" styleClass="ta" wrapText="true" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.vgrow="ALWAYS" />
<Button fx:id="handleSend" defaultButton="true" mnemonicParsing="false" onAction="#handleSend" text="Send" GridPane.rowIndex="7" />
<Label fx:id="paymentRequestError" opacity="0.0" text="Please use a valid payment request" GridPane.columnSpan="2" GridPane.rowIndex="2">
<styleClass>
<String fx:value="text-error" />
<String fx:value="text-error-upward" />
</styleClass></Label>
<Label styleClass="text-muted" text="Amount (mSat)" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
<Separator GridPane.columnSpan="2" GridPane.rowIndex="6" />
<Label styleClass="text-muted" text="Node Id" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<Label fx:id="amountLabel" text="0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label fx:id="nodeIdLabel" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label styleClass="text-muted" text="hash" GridPane.halignment="RIGHT" GridPane.rowIndex="5" />
<Label fx:id="hashLabel" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7" />
</children>
<styleClass>
<String fx:value="grid" />
<String fx:value="modal" />
</styleClass>
<stylesheets>
<URL value="@../commons/form.css" />
<URL value="@../commons/globals.css" />
<URL value="@modals.css" />
</stylesheets>
<GridPane fx:id="nodeId" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefWidth="395.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="150.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" maxWidth="292.0" minWidth="10.0" prefWidth="241.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="1.0" prefHeight="3.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="1.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label styleClass="text-strong" text="Enter a Payment Request below" GridPane.columnSpan="2"
GridPane.valignment="TOP"/>
<TextArea fx:id="paymentRequest" minHeight="150.0" prefHeight="150.0" styleClass="ta" wrapText="true"
GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.vgrow="ALWAYS"/>
<Button fx:id="handleSend" defaultButton="true" mnemonicParsing="false" onAction="#handleSend" text="Send"
GridPane.rowIndex="7"/>
<Label fx:id="paymentRequestError" opacity="0.0" text="Please use a valid payment request"
GridPane.columnSpan="2" GridPane.rowIndex="2">
<styleClass>
<String fx:value="text-error"/>
<String fx:value="text-error-upward"/>
</styleClass>
</Label>
<Label styleClass="text-muted" text="Amount (mSat)" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/>
<Separator GridPane.columnSpan="2" GridPane.rowIndex="6"/>
<Label styleClass="text-muted" text="Node Id" GridPane.halignment="RIGHT" GridPane.rowIndex="4"/>
<Label fx:id="amountLabel" text="0" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label fx:id="nodeIdLabel" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label styleClass="text-muted" text="hash" GridPane.halignment="RIGHT" GridPane.rowIndex="5"/>
<Label fx:id="hashLabel" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
<Button cancelButton="true" mnemonicParsing="false" onAction="#handleClose" styleClass="cancel" text="Cancel"
GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="7"/>
</children>
<styleClass>
<String fx:value="grid"/>
<String fx:value="modal"/>
</styleClass>
<stylesheets>
<URL value="@../commons/form.css"/>
<URL value="@../commons/globals.css"/>
<URL value="@modals.css"/>
</stylesheets>
</GridPane>

View file

@ -8,53 +8,61 @@
<?import javafx.scene.layout.*?>
<?import java.lang.String?>
<?import java.net.URL?>
<Pane fx:id="splash" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="457.0" prefWidth="760.0" styleClass="transparent" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.acinq.eclair.gui.controllers.SplashController">
<children>
<ImageView fx:id="imgBlurred" fitHeight="0" fitWidth="409.0" layoutX="176.0" layoutY="115.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../commons/images/eclair01-icon.png" />
</image>
<effect>
<BoxBlur height="114.75" width="92.44" />
</effect>
</ImageView>
<ImageView fx:id="img" fitHeight="0" fitWidth="409.0" layoutX="176.0" layoutY="114.0" opacity="0.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../commons/images/eclair01-icon.png" />
</image>
</ImageView>
<VBox fx:id="errorBox" alignment="CENTER" layoutX="195.0" layoutY="71.0" opacity="0.0" prefWidth="370.0" styleClass="error-box">
<children>
<GridPane hgap="10.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="40.0" prefWidth="40.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="45.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="RIGHT">
<image>
<Image url="@../commons/images/warning.png" />
</image>
</ImageView>
<Label fx:id="errorLabel" text="An error has occured!" wrapText="true" GridPane.columnIndex="1" />
</children>
<VBox.margin>
<Insets bottom="40.0" />
</VBox.margin>
</GridPane>
<Button fx:id="closeButton" mnemonicParsing="false" onAction="#closeAndKill" text="Close">
<styleClass>
<String fx:value="button" />
<String fx:value="grey" />
</styleClass></Button>
</children>
</VBox>
</children>
<stylesheets>
<URL value="@splash.css" />
<URL value="@../commons/globals.css" />
</stylesheets>
<Pane fx:id="splash" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefHeight="457.0" prefWidth="760.0" styleClass="transparent" xmlns="http://javafx.com/javafx/8.0.60"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="fr.acinq.eclair.gui.controllers.SplashController">
<children>
<ImageView fx:id="imgBlurred" fitHeight="0" fitWidth="409.0" layoutX="176.0" layoutY="115.0" pickOnBounds="true"
preserveRatio="true">
<image>
<Image url="@../commons/images/eclair01-icon.png"/>
</image>
<effect>
<BoxBlur height="114.75" width="92.44"/>
</effect>
</ImageView>
<ImageView fx:id="img" fitHeight="0" fitWidth="409.0" layoutX="176.0" layoutY="114.0" opacity="0.0"
pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../commons/images/eclair01-icon.png"/>
</image>
</ImageView>
<VBox fx:id="errorBox" alignment="CENTER" layoutX="195.0" layoutY="71.0" opacity="0.0" prefWidth="370.0"
styleClass="error-box">
<children>
<GridPane hgap="10.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="40.0" prefWidth="40.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="45.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true"
GridPane.halignment="RIGHT">
<image>
<Image url="@../commons/images/warning.png"/>
</image>
</ImageView>
<Label fx:id="errorLabel" text="An error has occured!" wrapText="true"
GridPane.columnIndex="1"/>
</children>
<VBox.margin>
<Insets bottom="40.0"/>
</VBox.margin>
</GridPane>
<Button fx:id="closeButton" mnemonicParsing="false" onAction="#closeAndKill" text="Close">
<styleClass>
<String fx:value="button"/>
<String fx:value="grey"/>
</styleClass>
</Button>
</children>
</VBox>
</children>
<stylesheets>
<URL value="@splash.css"/>
<URL value="@../commons/globals.css"/>
</stylesheets>
</Pane>

View file

@ -8,9 +8,9 @@
</encoder>
</appender>
<logger name="fr.acinq.eclair.channel" level="DEBUG" />
<logger name="fr.acinq.eclair.channel.Register" level="DEBUG" />
<logger name="fr.acinq.protos" level="DEBUG" />
<logger name="fr.acinq.eclair.channel" level="DEBUG"/>
<logger name="fr.acinq.eclair.channel.Register" level="DEBUG"/>
<logger name="fr.acinq.protos" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>

View file

@ -27,7 +27,8 @@
<OnMatch>ACCEPT</OnMatch>
</filter>
<encoder>
<pattern>%yellow(${HOSTNAME} %d) %highlight(%-5level) %logger{36} %X{akkaSource} - %blue(%msg) %ex{12}%n</pattern>
<pattern>%yellow(${HOSTNAME} %d) %highlight(%-5level) %logger{36} %X{akkaSource} - %blue(%msg) %ex{12}%n
</pattern>
</encoder>
</appender>
@ -42,13 +43,15 @@
<OnMatch>ACCEPT</OnMatch>
</filter>
<encoder>
<pattern>%yellow(${HOSTNAME} %d) %highlight(%-5level) %logger{36} %X{akkaSource} - %boldGreen(%msg) %ex{12}%n</pattern>
<pattern>%yellow(${HOSTNAME} %d) %highlight(%-5level) %logger{36} %X{akkaSource} - %boldGreen(%msg)
%ex{12}%n
</pattern>
</encoder>
</appender>
<logger name="fr.acinq.eclair.channel" level="DEBUG" />
<logger name="fr.acinq.eclair.router" level="DEBUG" />
<logger name="fr.acinq.eclair.blockchain.peer.PeerClient" level="INFO" />
<logger name="fr.acinq.eclair.channel" level="DEBUG"/>
<logger name="fr.acinq.eclair.router" level="DEBUG"/>
<logger name="fr.acinq.eclair.blockchain.peer.PeerClient" level="INFO"/>
<root level="INFO">
<appender-ref ref="CHANNEL"/>

View file

@ -15,7 +15,7 @@ class BinaryDataSerializer extends CustomSerializer[BinaryData](format => ( {
}, {
case x: BinaryData => JString(x.toString())
}
))
))
class StateSerializer extends CustomSerializer[State](format => ( {
case JString(x) if (false) => // NOT IMPLEMENTED
@ -23,7 +23,7 @@ class StateSerializer extends CustomSerializer[State](format => ( {
}, {
case x: State => JString(x.toString())
}
))
))
class ShaChainSerializer extends CustomSerializer[ShaChain](format => ( {
case JString(x) if (false) => // NOT IMPLEMENTED
@ -31,4 +31,4 @@ class ShaChainSerializer extends CustomSerializer[ShaChain](format => ( {
}, {
case x: ShaChain => JNull
}
))
))

View file

@ -41,9 +41,9 @@ class ExtendedBitcoinClient(val client: BitcoinJsonRPCClient) {
* @return a Future[txid] where txid (a String) is the is of the tx that sends the bitcoins
*/
def sendFromAccount(account: String, destination: String, amount: Double)(implicit ec: ExecutionContext): Future[String] =
client.invoke("sendfrom", account, destination, amount) collect {
case JString(txid) => txid
}
client.invoke("sendfrom", account, destination, amount) collect {
case JString(txid) => txid
}
/**
* @param txId
@ -133,7 +133,7 @@ class ExtendedBitcoinClient(val client: BitcoinJsonRPCClient) {
* @return the current number of blocks in the active chain
*/
def getBlockCount(implicit ec: ExecutionContext): Future[Long] =
client.invoke("getblockcount") collect {
case JInt(count) => count.toLong
}
client.invoke("getblockcount") collect {
case JInt(count) => count.toLong
}
}

View file

@ -10,12 +10,15 @@ import fr.acinq.bitcoin._
import scala.util.{Failure, Success, Try}
/**
* handles communication with a remote BTC node
* @param remote address of the remote node
* @param listener listener actor BTC messages sent by the remote node will be forwarded to
*/
* handles communication with a remote BTC node
*
* @param remote address of the remote node
* @param listener listener actor BTC messages sent by the remote node will be forwarded to
*/
class PeerHandler(remote: InetSocketAddress, listener: ActorRef) extends Actor with ActorLogging {
import akka.io.Tcp._
implicit val system = context.system
context.watch(listener)

View file

@ -9,6 +9,7 @@ import akka.actor.{Actor, ActorLogging, ActorRef}
/**
* Purpose of this actor is to be an alias for its origin actor.
* It allows to reference the using {{{system.actorSelection()}}} with a meaningful name
*
* @param origin aliased actor
*/
class AliasActor(origin: ActorRef) extends Actor with ActorLogging {

View file

@ -218,7 +218,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
case Event((anchorTx: Transaction, anchorOutputIndex: Int), DATA_WAIT_FOR_FUNDING_INTERNAL(temporaryChannelId, channelParams, pushMsat, remoteFirstPerCommitmentPoint)) =>
log.info(s"anchor txid=${anchorTx.txid}")
val theirSpec = CommitmentSpec(Set.empty[Htlc], feeRate = channelParams.remoteParams.feeratePerKb, to_local_msat = pushMsat, to_remote_msat = channelParams.fundingSatoshis * 1000 - pushMsat)
val theirRevocationPubkey: BinaryData = ??? // some combination of params.remoteParams.revocationBasepoint and remoteFirstPerCommitmentPoint
val theirRevocationPubkey: BinaryData = ???
// some combination of params.remoteParams.revocationBasepoint and remoteFirstPerCommitmentPoint
val ourSigForThem: BinaryData = ??? // signature of their initial commitment tx that pays them pushMsat
them ! FundingCreated(
temporaryChannelId = temporaryChannelId,
@ -258,7 +259,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
blockchain ! WatchSpent(self, anchorTxid, anchorOutputIndex, 0, BITCOIN_FUNDING_SPENT) // TODO : should we wait for an acknowledgment from watcher?
blockchain ! WatchConfirmed(self, anchorTxid, channelParams.minimumDepth.toInt, BITCOIN_FUNDING_DEPTHOK)
val ourRevocationPubkey: BinaryData = ??? // Helpers.revocationHash(ourParams.shaSeed, 0)
val ourRevocationPubkey: BinaryData = ???
// Helpers.revocationHash(ourParams.shaSeed, 0)
val ourTx: Transaction = ??? // makeOurTx(ourParams, theirParams, TxIn(OutPoint(anchorTxHash, anchorOutputIndex), Array.emptyByteArray, 0xffffffffL) :: Nil, ourRevocationHash, ourSpec)
val commitments = Commitments(channelParams.localParams, channelParams.remoteParams,
@ -285,7 +287,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
val ourTx = makeLocalTx(channelParams.localParams, channelParams.remoteParams, TxIn(OutPoint(anchorTx, anchorOutputIndex), Array.emptyByteArray, 0xffffffffL) :: Nil, ourRevocationHash, ourSpec)
log.info(s"checking our tx: $ourTx")
val ourSig = sign(channelParams.localParams, channelParams.remoteParams, anchorAmount, ourTx)
val signedTx: Transaction = ??? //addSigs(ourParams, theirParams, anchorAmount, ourTx, ourSig, theirSig)
val signedTx: Transaction = ???
//addSigs(ourParams, theirParams, anchorAmount, ourTx, ourSig, theirSig)
val anchorOutput: TxOut = ??? //anchorTx.txOut(anchorOutputIndex)
checksig(channelParams.localParams, channelParams.remoteParams, anchorOutput, signedTx) match {
case Failure(cause) =>
@ -552,7 +555,6 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
case Event(CMD_SIGN, d: DATA_SHUTDOWN) if d.commitments.remoteNextCommitInfo.isLeft =>
//TODO : this is a temporary fix
log.info(s"already in the process of signing, delaying CMD_SIGN")
import scala.concurrent.ExecutionContext.Implicits.global
context.system.scheduler.scheduleOnce(100 milliseconds, self, CMD_SIGN)
stay
@ -706,7 +708,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
stay
case Event(CMD_GETINFO, _) =>
sender ! RES_GETINFO(theirNodeId, stateData match { // TODO
sender ! RES_GETINFO(theirNodeId, stateData match {
// TODO
case c: DATA_WAIT_FOR_OPEN_CHANNEL => 0L
case c: DATA_WAIT_FOR_ACCEPT_CHANNEL => c.temporaryChannelId
case c: DATA_WAIT_FOR_FUNDING_CREATED => c.temporaryChannelId
@ -853,7 +856,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
log.warning(s"txid=${tx.txid} was a revoked commitment, publishing the punishment tx")
them ! Error(0, "Anchor has been spent".getBytes)
blockchain ! Publish(spendingTx)
blockchain ! WatchConfirmed(self, spendingTx.txid, 3, BITCOIN_STEAL_DONE) // TODO hardcoded mindepth
blockchain ! WatchConfirmed(self, spendingTx.txid, 3, BITCOIN_STEAL_DONE)
// TODO hardcoded mindepth
val nextData = d match {
case closing: DATA_CLOSING => closing.copy(revokedPublished = closing.revokedPublished :+ tx)
case _ => DATA_CLOSING(d.commitments, revokedPublished = Seq(tx))

View file

@ -71,7 +71,7 @@ object Register {
* which name is counterparty_id-anchor_id
*/
def create_alias(node_id: BinaryData, anchor_id: BinaryData)(implicit context: ActorContext) =
context.actorOf(Props(new AliasActor(context.self)), name = s"$node_id-$anchor_id")
context.actorOf(Props(new AliasActor(context.self)), name = s"$node_id-$anchor_id")
def actorPathToNodeId(system: ActorSystem, nodeId: BinaryData): ActorPath =
system / "register" / "auth-handler-*" / "channel" / s"${nodeId}-*"

View file

@ -10,15 +10,19 @@ import fr.acinq.eclair.transactions._
*/
object Scripts {
def toSelfDelay2csv(in: Int): Long = ??? /*in match {
case locktime(Blocks(blocks)) => blocks
case locktime(Seconds(seconds)) => TxIn.SEQUENCE_LOCKTIME_TYPE_FLAG | (seconds >> TxIn.SEQUENCE_LOCKTIME_GRANULARITY)
}*/
def toSelfDelay2csv(in: Int): Long = ???
def expiry2cltv(in: Long): Long = ???/*in match {
case locktime(Blocks(blocks)) => blocks
case locktime(Seconds(seconds)) => seconds
}*/
/*in match {
case locktime(Blocks(blocks)) => blocks
case locktime(Seconds(seconds)) => TxIn.SEQUENCE_LOCKTIME_TYPE_FLAG | (seconds >> TxIn.SEQUENCE_LOCKTIME_GRANULARITY)
}*/
def expiry2cltv(in: Long): Long = ???
/*in match {
case locktime(Blocks(blocks)) => blocks
case locktime(Seconds(seconds)) => seconds
}*/
def isLess(a: Seq[Byte], b: Seq[Byte]): Boolean = memcmp(a.dropWhile(_ == 0).toList, b.dropWhile(_ == 0).toList) < 0
@ -257,6 +261,7 @@ object Scripts {
sequence & TxIn.SEQUENCE_LOCKTIME_MASK
}
}
if (tx.version < 2) 0
else tx.txIn.map(_.sequence).map(sequenceToBlockHeight).max
}

View file

@ -23,7 +23,7 @@ import scala.annotation.tailrec
case class Encryptor(key: BinaryData, nonce: Long)
object Encryptor {
def encrypt(encryptor: Encryptor, data: BinaryData) : (Encryptor, BinaryData) = {
def encrypt(encryptor: Encryptor, data: BinaryData): (Encryptor, BinaryData) = {
val header = Protocol.writeUInt32(data.length)
val (ciphertext1, mac1) = AeadChacha20Poly1305.encrypt(encryptor.key, Protocol.writeUInt64(encryptor.nonce), header, Array.emptyByteArray)
val (ciphertext2, mac2) = AeadChacha20Poly1305.encrypt(encryptor.key, Protocol.writeUInt64(encryptor.nonce + 1), data, Array.emptyByteArray)

View file

@ -7,22 +7,22 @@ import scala.util.Random
/**
* Created by PM on 14/10/2015.
*/
* Created by PM on 14/10/2015.
*/
object Onion extends App {
lazy val zeroes: BinaryData = Array.fill(192)(0:Byte)
lazy val zeroes: BinaryData = Array.fill(192)(0: Byte)
def encPad(secrets: Secrets)(input: BinaryData) : BinaryData = aesEncrypt(input, secrets.aes_key, secrets.pad_iv)
def encPad(secrets: Secrets)(input: BinaryData): BinaryData = aesEncrypt(input, secrets.aes_key, secrets.pad_iv)
def decPad(secrets: Secrets)(input: BinaryData) : BinaryData = aesDecrypt(input, secrets.aes_key, secrets.pad_iv)
def decPad(secrets: Secrets)(input: BinaryData): BinaryData = aesDecrypt(input, secrets.aes_key, secrets.pad_iv)
def encMsg(secrets: Secrets)(input: BinaryData) : BinaryData = aesEncrypt(input, secrets.aes_key, secrets.iv)
def encMsg(secrets: Secrets)(input: BinaryData): BinaryData = aesEncrypt(input, secrets.aes_key, secrets.iv)
def decMsg(secrets: Secrets)(input: BinaryData) : BinaryData = aesDecrypt(input, secrets.aes_key, secrets.iv)
def decMsg(secrets: Secrets)(input: BinaryData): BinaryData = aesDecrypt(input, secrets.aes_key, secrets.iv)
def hmac(secrets: Secrets)(input: BinaryData) : BinaryData = hmac256(secrets.hmac_key, input)
def hmac(secrets: Secrets)(input: BinaryData): BinaryData = hmac256(secrets.hmac_key, input)
def makeLastMessage(clientPrivateKeys: Seq[BinaryData], nodePublicKeys: Seq[BinaryData], plaintext: Seq[BinaryData]) : BinaryData = {
def makeLastMessage(clientPrivateKeys: Seq[BinaryData], nodePublicKeys: Seq[BinaryData], plaintext: Seq[BinaryData]): BinaryData = {
val size = clientPrivateKeys.length
val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i)))
var padding: BinaryData = Array.empty[Byte]
@ -35,14 +35,14 @@ object Onion extends App {
unsigned ++ hmac(secrets.last)(unsigned)
}
def makePreviousMessage(nextMessage: BinaryData, secret: Secrets, clientPrivateKey: BinaryData, plaintext: BinaryData) : BinaryData = {
def makePreviousMessage(nextMessage: BinaryData, secret: Secrets, clientPrivateKey: BinaryData, plaintext: BinaryData): BinaryData = {
val encrypted = encMsg(secret)(nextMessage.drop(192) ++ plaintext)
val pub: BinaryData = Crypto.publicKeyFromPrivateKey(clientPrivateKey :+ 1.toByte)
val unsigned = encrypted ++ pub.drop(1)
unsigned ++ hmac(secret)(unsigned)
}
def makeFirstMessage(clientPrivateKeys: Seq[BinaryData], nodePublicKeys: Seq[BinaryData], plaintext: Seq[BinaryData]) : BinaryData = {
def makeFirstMessage(clientPrivateKeys: Seq[BinaryData], nodePublicKeys: Seq[BinaryData], plaintext: Seq[BinaryData]): BinaryData = {
val size = clientPrivateKeys.length
val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i)))
val lastMessage = makeLastMessage(clientPrivateKeys, nodePublicKeys, plaintext)
@ -64,7 +64,7 @@ object Onion extends App {
val sig2 = hmac256(secrets.hmac_key, buf.dropRight(32))
if (!sig.data.sameElements(sig2.data)) throw new RuntimeException("sig mismatch!")
val decrypted:BinaryData = aesDecrypt(buf.dropRight(64).toArray, secrets.aes_key, secrets.iv)
val decrypted: BinaryData = aesDecrypt(buf.dropRight(64).toArray, secrets.aes_key, secrets.iv)
val payload = decrypted.takeRight(128)
val payloadstring = new String(payload.toArray)
val newmsg = aesEncrypt(Array.fill[Byte](192)(0x00), secrets.aes_key, secrets.pad_iv) ++ decrypted.dropRight(128)

View file

@ -21,11 +21,12 @@ import org.jgrapht.graph.{DefaultEdge, SimpleGraph}
/**
* Created by PM on 16/08/2016.
*/
class GUIUpdater(primaryStage: Stage, mainController:MainController, setup: Setup) extends Actor with ActorLogging {
class GUIUpdater(primaryStage: Stage, mainController: MainController, setup: Setup) extends Actor with ActorLogging {
class NamedEdge(val id: BinaryData) extends DefaultEdge {
override def toString: String = s"${id.toString.take(8)}..."
}
val graph = new SimpleGraph[BinaryData, NamedEdge](classOf[NamedEdge])
graph.addVertex(Globals.Node.publicKey)

View file

@ -108,7 +108,7 @@ class MainController(val handlers: Handlers, val stage: Stage, val setup: Setup)
}
@FXML def handleNodeIdContext(event: ContextMenuEvent): Unit = {
contextMenu.show(labelNodeId, event.getScreenX, event.getScreenY)
contextMenu.show(labelNodeId, event.getScreenX, event.getScreenY)
}
def positionAtCenter(childStage: Stage): Unit = {

View file

@ -40,7 +40,8 @@ class OpenChannelController(val handlers: Handlers, val stage: Stage, val setup:
stage.close()
}
}
@FXML def handleClose (event: ActionEvent): Unit = {
@FXML def handleClose(event: ActionEvent): Unit = {
stage.close()
}
}

View file

@ -15,26 +15,27 @@ import scala.util.{Success, Try}
/**
* Created by DPA on 23/09/2016.
*/
class ReceivePaymentController(val handlers:Handlers, val stage:Stage, val setup:Setup) extends BaseController with Logging {
class ReceivePaymentController(val handlers: Handlers, val stage: Stage, val setup: Setup) extends BaseController with Logging {
@FXML var amount:TextField = _
@FXML var amountError:Label = _
@FXML var amount: TextField = _
@FXML var amountError: Label = _
// this field is generated and readonly
@FXML var paymentRequest:TextArea = _
@FXML var paymentRequest: TextArea = _
@FXML def initialize (): Unit = {
@FXML def initialize(): Unit = {
}
@FXML def handleGenerate (event: ActionEvent): Unit = {
@FXML def handleGenerate(event: ActionEvent): Unit = {
if (GUIValidators.validate(amount.getText, amountError, GUIValidators.amountRegex)) {
Try(amount.getText.toLong) match {
case Success (amountMsat) => handlers.getPaymentRequest(amount.getText.toLong, paymentRequest)
case Success(amountMsat) => handlers.getPaymentRequest(amount.getText.toLong, paymentRequest)
case _ => {}
}
}
}
@FXML def handleClose (event: ActionEvent): Unit = {
@FXML def handleClose(event: ActionEvent): Unit = {
stage.close()
}
}

View file

@ -15,15 +15,15 @@ import grizzled.slf4j.Logging
/**
* Created by DPA on 23/09/2016.
*/
class SendPaymentController(val handlers:Handlers, val stage:Stage, val setup:Setup) extends BaseController with Logging {
class SendPaymentController(val handlers: Handlers, val stage: Stage, val setup: Setup) extends BaseController with Logging {
@FXML var paymentRequest:TextArea = _
@FXML var paymentRequestError:Label = _
@FXML var nodeIdLabel:Label = _
@FXML var amountLabel:Label = _
@FXML var hashLabel:Label = _
@FXML var paymentRequest: TextArea = _
@FXML var paymentRequestError: Label = _
@FXML var nodeIdLabel: Label = _
@FXML var amountLabel: Label = _
@FXML var hashLabel: Label = _
@FXML def initialize (): Unit = {
@FXML def initialize(): Unit = {
paymentRequest.textProperty().addListener(new ChangeListener[String] {
def changed(observable: ObservableValue[_ <: String], oldValue: String, newValue: String): Unit = {
@ -41,7 +41,7 @@ class SendPaymentController(val handlers:Handlers, val stage:Stage, val setup:Se
})
}
@FXML def handleSend (event: ActionEvent): Unit = {
@FXML def handleSend(event: ActionEvent): Unit = {
if (GUIValidators.validate(paymentRequest.getText, paymentRequestError, GUIValidators.paymentRequestRegex)) {
val Array(nodeId, amount, hash) = paymentRequest.getText.split(":")
handlers.send(nodeId, hash, amount)
@ -50,7 +50,7 @@ class SendPaymentController(val handlers:Handlers, val stage:Stage, val setup:Se
}
@FXML def handleClose (event: ActionEvent): Unit = {
@FXML def handleClose(event: ActionEvent): Unit = {
stage.close()
}
}

View file

@ -12,7 +12,7 @@ import fr.acinq.eclair.gui.controllers.OpenChannelController
/**
* Created by PM on 16/08/2016.
*/
class OpenChannelStage(handlers: Handlers, setup:Setup) extends Stage() {
class OpenChannelStage(handlers: Handlers, setup: Setup) extends Stage() {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false))

View file

@ -12,7 +12,7 @@ import fr.acinq.eclair.gui.controllers.ReceivePaymentController
/**
* Created by PM on 16/08/2016.
*/
class ReceivePaymentStage(handlers: Handlers, setup:Setup) extends Stage() {
class ReceivePaymentStage(handlers: Handlers, setup: Setup) extends Stage() {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false))

View file

@ -13,7 +13,7 @@ import grizzled.slf4j.Logging
/**
* Created by PM on 16/08/2016.
*/
class SendPaymentStage(handlers: Handlers, setup:Setup) extends Stage() with Logging {
class SendPaymentStage(handlers: Handlers, setup: Setup) extends Stage() with Logging {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false))

View file

@ -12,6 +12,7 @@ object ContextMenuUtils {
/**
* Builds a Context Menu with a single Copy action.
*
* @param valueToCopy the value to copy to clipboard
* @return javafx context menu
*/

View file

@ -21,6 +21,7 @@ class LocalPaymentHandler extends Actor with ActorLogging {
random.nextBytes(r)
r
}
override def receive: Receive = run(Map())
//TODO: store this map on file ?

View file

@ -31,7 +31,7 @@ class Router extends Actor with ActorLogging {
log.info(s"removed channel ${c.id} from available routes")
context become main(channels - c.id)
case 'network => sender ! channels.values
case RouteRequest(start, end) => findRoute(start, end, channels) map(RouteResponse(_)) pipeTo sender
case RouteRequest(start, end) => findRoute(start, end, channels) map (RouteResponse(_)) pipeTo sender
}
}

View file

@ -76,14 +76,18 @@ object CommitmentSpec {
}
def makeLocalTxTemplate(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], ourRevocationHash: BinaryData, spec: CommitmentSpec): CommitTxTemplate = ???
//makeCommitTxTemplate(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec)
def makeLocalTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], ourRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ???
//makeCommitTx(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec)
def makeRemoteTxTemplate(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): CommitTxTemplate = ???
//makeCommitTxTemplate(inputs, theirParams.finalPubKey, ourParams.finalPubKey, theirParams.delay, theirRevocationHash, spec)
def makeRemoteTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ???
//makeTheirTxTemplate(ourParams, theirParams, inputs, theirRevocationHash, spec).makeTx
}

View file

@ -11,14 +11,17 @@ import scala.util.Try
object Signature {
def sign(localParams: LocalParams, RemoteParams: RemoteParams, anchorAmount: Satoshi, tx: Transaction): BinaryData = ???
//bin2signature(Transaction.signInput(tx, 0, multiSig2of2(ourParams.commitPubKey, theirParams.commitPubKey), SIGHASH_ALL, anchorAmount, 1, ourParams.commitPrivKey))
def addSigs(localParams: LocalParams, RemoteParams: RemoteParams, anchorAmount: Satoshi, tx: Transaction, ourSig: BinaryData, theirSig: BinaryData): Transaction = ??? /*{
// TODO : Transaction.sign(...) should handle multisig
val ourSig = Transaction.signInput(tx, 0, multiSig2of2(ourParams.commitPubKey, theirParams.commitPubKey), SIGHASH_ALL, anchorAmount, 1, ourParams.commitPrivKey)
val witness = witness2of2(theirSig, ourSig, theirParams.commitPubKey, ourParams.commitPubKey)
tx.updateWitness(0, witness)
}*/
def addSigs(localParams: LocalParams, RemoteParams: RemoteParams, anchorAmount: Satoshi, tx: Transaction, ourSig: BinaryData, theirSig: BinaryData): Transaction = ???
/*{
// TODO : Transaction.sign(...) should handle multisig
val ourSig = Transaction.signInput(tx, 0, multiSig2of2(ourParams.commitPubKey, theirParams.commitPubKey), SIGHASH_ALL, anchorAmount, 1, ourParams.commitPrivKey)
val witness = witness2of2(theirSig, ourSig, theirParams.commitPubKey, ourParams.commitPubKey)
tx.updateWitness(0, witness)
}*/
def checksig(localParams: LocalParams, RemoteParams: RemoteParams, anchorOutput: TxOut, tx: Transaction): Try[Unit] =
Try(Transaction.correctlySpends(tx, Map(tx.txIn(0).outPoint -> anchorOutput), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS))

View file

@ -71,11 +71,11 @@ case class ClosingSigned(channelId: Long,
signature: BinaryData) extends ChannelMessage
case class UpdateAddHtlc(channelId: Long,
id: Long,
amountMsat: Long,
expiry: Long,
paymentHash: BinaryData,
onionRoutingPacket: BinaryData) extends HtlcMessage with UpdateMessage
id: Long,
amountMsat: Long,
expiry: Long,
paymentHash: BinaryData,
onionRoutingPacket: BinaryData) extends HtlcMessage with UpdateMessage
case class UpdateFulfillHtlc(channelId: Long,
id: Long,

View file

@ -95,7 +95,7 @@ object NewChannel extends App {
val pipe = system.actorOf(Props(new TestPipe()))
val a = system.actorOf(Props(new ChannelMock(pipe)), name = "a")
val b = system.actorOf(Props(new ChannelMock(pipe)), name = "b")
pipe !(a, b, new File("eclair-node/rusty-scripts/15-fee-twice-back-to-back.script"))
pipe ! (a, b, new File("eclair-node/rusty-scripts/15-fee-twice-back-to-back.script"))
}
@ -118,6 +118,7 @@ class TestPipe() extends Actor with ActorLogging with Stash {
def exec(script: List[String], a: ActorRef, b: ActorRef): Unit = {
def resolve(x: String) = if (x == "A") a else b
script match {
case offer(x, i) :: rest =>
resolve(x) ! CmdOffer(i.toInt)
@ -188,8 +189,11 @@ class TestPipe() extends Actor with ActorLogging with Stash {
s" Offered htlcs: ${my_commit.selected.filter(_ % 2 != even).mkString(" ")}",
s" Received htlcs: ${my_commit.selected.filter(_ % 2 == even).mkString(" ")}",
s" Fee level ${my_commit.fee_level}",
s" SIGNED").filterNot(_ == " Fee level 0") // TODO ???
def rtrim(s: String) = s.replaceAll("\\s+$", "")
s" SIGNED").filterNot(_ == " Fee level 0")
// TODO ???
def rtrim(s: String) = s.replaceAll("\\s+$", "")
l.foreach(s => {
fout.write(rtrim(s))
fout.newLine()

View file

@ -12,10 +12,13 @@ import scala.util.Random
*/
case class CMD_SendChange(change: String)
case class CMD_SendSig()
case class PKT_ReceiveChange(change: String)
case class PKT_ReceiveSig(sig: Set[Change])
case class PKT_ReceiveRev()
class BilateralCommitActor(counterparty: ActorRef) extends Actor with ActorLogging {
@ -90,12 +93,14 @@ object BilateralCommitActorTest extends App {
var i = new AtomicLong(0)
val random = new Random()
def msg = random.nextInt(100) % 5 match {
case 0 | 1 | 2 | 3 => CMD_SendChange(s"A${i.incrementAndGet()}")
case 4 => CMD_SendSig()
}
import scala.concurrent.ExecutionContext.Implicits.global
system.scheduler.schedule(0 seconds, 5 milliseconds, new Runnable() {
override def run(): Unit = a ! msg
})

View file

@ -10,7 +10,7 @@ import org.scalatest.junit.JUnitRunner
class PermuteOutputSpec extends FlatSpec {
"permuteOutputs" should "permute tx output in a determinstic way" in {
val pub1: BinaryData = "0394D30868076AB1EA7736ED3BDBEC99497A6AD30B25AFD709CDF3804CD389996A"
val pub2 : BinaryData = "032C58BC9615A6FF24E9132CEF33F1EF373D97DC6DA7933755BC8BB86DBEE9F55C"
val pub2: BinaryData = "032C58BC9615A6FF24E9132CEF33F1EF373D97DC6DA7933755BC8BB86DBEE9F55C"
val pub3: BinaryData = "02C4D72D99CA5AD12C17C9CFE043DC4E777075E8835AF96F46D8E3CCD929FE1926"
val outputs = Seq(

View file

@ -16,6 +16,7 @@ import scala.concurrent.{ExecutionContext, Future}
class TestBitcoinClient()(implicit system: ActorSystem) extends ExtendedBitcoinClient(new BitcoinJsonRPCClient("", "", "", 0)) {
import scala.concurrent.ExecutionContext.Implicits.global
system.scheduler.schedule(100 milliseconds, 100 milliseconds, new Runnable {
override def run(): Unit = system.eventStream.publish(NewBlock(null)) // blocks are not actually interpreted
})

View file

@ -11,7 +11,9 @@ import fr.acinq.eclair.transactions.{CommitmentSpec, Htlc}
object TestConstants {
val anchorAmount = 1000000L
lazy val anchorOutput: TxOut = ??? //TxOut(Satoshi(anchorAmount), publicKeyScript = Scripts.anchorPubkeyScript(Alice.channelParams.commitPubKey, Bob.channelParams.commitPubKey))
lazy val anchorOutput: TxOut = ???
//TxOut(Satoshi(anchorAmount), publicKeyScript = Scripts.anchorPubkeyScript(Alice.channelParams.commitPubKey, Bob.channelParams.commitPubKey))
// Alice is funder, Bob is not
@ -84,12 +86,13 @@ object TestConstants {
val ourTx: Transaction = ??? // Helpers.makeOurTx(channelParams, TheirChannelParams(Alice.channelParams), TxIn(OutPoint(Hash.One, 0), Array.emptyByteArray, 0xffffffffL) :: Nil, revocationHash(0), ourSpec)
val commitments: Commitments = ???/*Commitments(
Bob.channelParams,
TheirChannelParams(Alice.channelParams),
OurCommit(0, ourSpec, ourTx), TheirCommit(0, theirSpec, BinaryData(""), Alice.revocationHash(0)),
OurChanges(Nil, Nil, Nil), TheirChanges(Nil, Nil), 0L,
Right(Alice.revocationHash(1)), anchorOutput, ShaChain.init, new BasicTxDb)*/
val commitments: Commitments = ???
/*Commitments(
Bob.channelParams,
TheirChannelParams(Alice.channelParams),
OurCommit(0, ourSpec, ourTx), TheirCommit(0, theirSpec, BinaryData(""), Alice.revocationHash(0)),
OurChanges(Nil, Nil, Nil), TheirChanges(Nil, Nil), 0L,
Right(Alice.revocationHash(1)), anchorOutput, ShaChain.init, new BasicTxDb)*/
}
}

View file

@ -9,33 +9,33 @@ import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class HelpersSpec extends FunSuite {
test("add, fulfill and fail htlcs") {
val spec = CommitmentSpec(Set(), 1000, 2000 * 1000, 0)
val R1 = Crypto.sha256("foo".getBytes())
val H1 = Crypto.sha256(R1)
val R2 = Crypto.sha256("bar".getBytes())
val H2 = Crypto.sha256(R2)
test("add, fulfill and fail htlcs") {
val spec = CommitmentSpec(Set(), 1000, 2000 * 1000, 0)
val R1 = Crypto.sha256("foo".getBytes())
val H1 = Crypto.sha256(R1)
val R2 = Crypto.sha256("bar".getBytes())
val H2 = Crypto.sha256(R2)
val ours1 = UpdateAddHtlc(0, 1, 1000, 400, H1, "")
val spec1 = CommitmentSpec.reduce(spec, ours1 :: Nil, Nil)
assert(spec1.htlcs.size == 1 && spec1.htlcs.head.add.id == 1 && spec1.htlcs.head.add.paymentHash == H1)
assert(spec1.to_local_msat == spec.to_local_msat - ours1.amountMsat)
assert(spec1.to_remote_msat == spec.to_remote_msat)
assert(spec1.totalFunds == spec.totalFunds)
val ours1 = UpdateAddHtlc(0, 1, 1000, 400, H1, "")
val spec1 = CommitmentSpec.reduce(spec, ours1 :: Nil, Nil)
assert(spec1.htlcs.size == 1 && spec1.htlcs.head.add.id == 1 && spec1.htlcs.head.add.paymentHash == H1)
assert(spec1.to_local_msat == spec.to_local_msat - ours1.amountMsat)
assert(spec1.to_remote_msat == spec.to_remote_msat)
assert(spec1.totalFunds == spec.totalFunds)
val theirs1 = UpdateFulfillHtlc(0, ours1.id, R1)
val spec2 = CommitmentSpec.reduce(spec1, Nil, theirs1 :: Nil)
assert(spec2.htlcs.isEmpty && spec2.to_remote_msat == 1000 && spec2.totalFunds == spec.totalFunds)
val theirs1 = UpdateFulfillHtlc(0, ours1.id, R1)
val spec2 = CommitmentSpec.reduce(spec1, Nil, theirs1 :: Nil)
assert(spec2.htlcs.isEmpty && spec2.to_remote_msat == 1000 && spec2.totalFunds == spec.totalFunds)
val theirs2 = UpdateAddHtlc(0, 2, 1000, 400, H2, "")
val spec3 = CommitmentSpec.reduce(spec2, Nil, theirs2 :: Nil)
assert(spec3.htlcs.size == 1)
assert(spec3.to_local_msat == spec2.to_local_msat)
assert(spec3.to_remote_msat == spec2.to_remote_msat - theirs2.amountMsat)
assert(spec3.totalFunds == spec.totalFunds)
val theirs2 = UpdateAddHtlc(0, 2, 1000, 400, H2, "")
val spec3 = CommitmentSpec.reduce(spec2, Nil, theirs2 :: Nil)
assert(spec3.htlcs.size == 1)
assert(spec3.to_local_msat == spec2.to_local_msat)
assert(spec3.to_remote_msat == spec2.to_remote_msat - theirs2.amountMsat)
assert(spec3.totalFunds == spec.totalFunds)
val ours2 = UpdateFailHtlc(0, theirs2.id, "")
val spec4 = CommitmentSpec.reduce(spec3, ours2 :: Nil, Nil)
assert(spec4 == spec2)
}
val ours2 = UpdateFailHtlc(0, theirs2.id, "")
val spec4 = CommitmentSpec.reduce(spec3, ours2 :: Nil, Nil)
assert(spec4 == spec2)
}
}

View file

@ -100,7 +100,7 @@ class NominalChannelSpec extends BaseChannelTestClass {
case d: DATA_NORMAL =>
assert(d.commitments.localCommit.spec.htlcs.isEmpty)
assert(d.commitments.localCommit.spec.to_local_msat == 60000000)
assert(d.commitments.localCommit.spec.to_remote_msat == TestConstants.anchorAmount * 1000 - 60000000)
assert(d.commitments.localCommit.spec.to_remote_msat == TestConstants.anchorAmount * 1000 - 60000000)
}
// send another HTLC

View file

@ -14,7 +14,7 @@ import scala.concurrent.duration._
class StealChannelSpec extends BaseChannelTestClass {
test("steal revoked commit tx") { case (alice, bob, pipe) =>
pipe !(alice, bob) // this starts the communication between alice and bob
pipe ! (alice, bob) // this starts the communication between alice and bob
within(30 seconds) {
@ -41,7 +41,7 @@ class StealChannelSpec extends BaseChannelTestClass {
alice ! CMD_SIGN
Thread.sleep(500)
bob !(BITCOIN_FUNDING_SPENT, commitTx)
bob ! (BITCOIN_FUNDING_SPENT, commitTx)
awaitCond(bob.stateName == CLOSING)
}
}

View file

@ -68,6 +68,7 @@ class ThroughputSpec extends FunSuite {
var i = new AtomicLong(0)
val random = new Random()
def msg = random.nextInt(100) % 5 match {
case 0 | 1 | 2 | 3 => 'add
case 4 => 'sig

View file

@ -21,7 +21,7 @@ object EncryptorSpec {
def receive = running(Encryptor(sendingKey, 0), Decryptor(receivinKey, 0))
def running(encryptor: Encryptor, decryptor: Decryptor) : Receive = {
def running(encryptor: Encryptor, decryptor: Decryptor): Receive = {
case chunk: BinaryData =>
val decryptor1 = Decryptor.add(decryptor, ByteString.fromArray(chunk))
decryptor1.bodies.map(_ => latch.countDown())
@ -33,10 +33,12 @@ object EncryptorSpec {
context become running(encryptor1, decryptor)
}
}
}
@RunWith(classOf[JUnitRunner])
class EncryptorSpec extends FunSuite {
import EncryptorSpec._
test("encryption/description tests") {

View file

@ -19,7 +19,7 @@ class LightningCryptoSpec extends FunSuite {
}
test("Chacha20") {
val plaintext: BinaryData = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.".getBytes
val plaintext: BinaryData = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.".getBytes
val key: BinaryData = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
val nonce: BinaryData = "0000004a00000000"

View file

@ -55,7 +55,7 @@ class OnionSpec extends FunSuite {
"d93db8019a9392b3df11929896639ab1a069a0096e3defa595af16544957526b"
)
val pubs = privs.map(k => Crypto.publicKeyFromPrivateKey(k :+ 1.toByte):BinaryData)
val pubs = privs.map(k => Crypto.publicKeyFromPrivateKey(k :+ 1.toByte): BinaryData)
val node_keys: List[(BinaryData, BinaryData)] = List(
("665af9917fbbd9758fd53352275f9b555296ee16e20a73a069931959c0980935", "0204053aed6a50fd4062331fc951d5da830ba64c02bfd7a64571fe16a7c46befa8"),

View file

@ -21,7 +21,7 @@ class RustyTestsMockSpec extends TestKit(ActorSystem("test")) with Matchers with
val pipe: TestActorRef[TestPipe] = TestActorRef[TestPipe]
val alice: TestFSMRef[StateMock, DataMock, ChannelMock] = TestFSMRef(new ChannelMock(pipe))
val bob: TestFSMRef[StateMock, DataMock, ChannelMock] = TestFSMRef(new ChannelMock(pipe))
pipe !(alice, bob, new File(s"rusty-scripts/${test.name}.script"))
pipe ! (alice, bob, new File(s"rusty-scripts/${test.name}.script"))
awaitCond(pipe.underlying.isTerminated, 30 seconds)
val ref = Source.fromFile(new File(s"rusty-scripts/${test.name}.script.expected")).getLines().filterNot(_.startsWith("#")).toList
val res = Source.fromFile(new File("result.txt")).getLines().filterNot(_.startsWith("#")).toList
@ -32,15 +32,15 @@ class RustyTestsMockSpec extends TestKit(ActorSystem("test")) with Matchers with
TestKit.shutdownActorSystem(system)
}
test("01-offer1") { case (ref, res) => assert(ref === res)}
test("02-offer2") { case (ref, res) => assert(ref === res)}
test("03-fulfill1") { case (ref, res) => assert(ref === res)}
test("04-two-commits-onedir") { case (ref, res) => assert(ref === res)}
test("05-two-commits-in-flight") { case (ref, res) => assert(ref === res)}
test("10-offers-crossover") { case (ref, res) => assert(ref === res)}
test("11-commits-crossover") { case (ref, res) => assert(ref === res)}
test("13-fee") { case (ref, res) => assert(ref === res)}
test("14-fee-twice") { case (ref, res) => assert(ref === res)}
test("15-fee-twice-back-to-back") { case (ref, res) => assert(ref === res)}
test("01-offer1") { case (ref, res) => assert(ref === res) }
test("02-offer2") { case (ref, res) => assert(ref === res) }
test("03-fulfill1") { case (ref, res) => assert(ref === res) }
test("04-two-commits-onedir") { case (ref, res) => assert(ref === res) }
test("05-two-commits-in-flight") { case (ref, res) => assert(ref === res) }
test("10-offers-crossover") { case (ref, res) => assert(ref === res) }
test("11-commits-crossover") { case (ref, res) => assert(ref === res) }
test("13-fee") { case (ref, res) => assert(ref === res) }
test("14-fee-twice") { case (ref, res) => assert(ref === res) }
test("15-fee-twice-back-to-back") { case (ref, res) => assert(ref === res) }
}

View file

@ -33,7 +33,7 @@ class RustyTestsSpec extends TestKit(ActorSystem("test")) with Matchers with fix
val paymentHandler = system.actorOf(Props(new NoopPaymentHandler()))
val alice: TestFSMRef[State, Data, Channel] = TestFSMRef(new Channel(pipe, blockchainA, paymentHandler, Alice.channelParams, "B"))
val bob: TestFSMRef[State, Data, Channel] = TestFSMRef(new Channel(pipe, blockchainB, paymentHandler, Bob.channelParams, "A"))
pipe !(alice, bob)
pipe ! (alice, bob)
within(30 seconds) {
awaitCond(alice.stateName == NORMAL)
awaitCond(bob.stateName == NORMAL)
@ -49,13 +49,13 @@ class RustyTestsSpec extends TestKit(ActorSystem("test")) with Matchers with fix
TestKit.shutdownActorSystem(system)
}
test("01-offer1") { case (ref, res) => assert(ref === res)}
test("02-offer2") { case (ref, res) => assert(ref === res)}
test("03-fulfill1") { case (ref, res) => assert(ref === res)}
test("04-two-commits-onedir") { case (ref, res) => assert(ref === res)}
test("01-offer1") { case (ref, res) => assert(ref === res) }
test("02-offer2") { case (ref, res) => assert(ref === res) }
test("03-fulfill1") { case (ref, res) => assert(ref === res) }
test("04-two-commits-onedir") { case (ref, res) => assert(ref === res) }
// test("05-two-commits-in-flight") { case (ref, res) => assert(ref === res)} DOES NOT PASS : cannot send two commit in a row (without having first revocation)
test("10-offers-crossover") { case (ref, res) => assert(ref === res)}
test("11-commits-crossover") { case (ref, res) => assert(ref === res)}
test("10-offers-crossover") { case (ref, res) => assert(ref === res) }
test("11-commits-crossover") { case (ref, res) => assert(ref === res) }
/*test("13-fee") { case (ref, res) => assert(ref === res)}
test("14-fee-twice") { case (ref, res) => assert(ref === res)}
test("15-fee-twice-back-to-back") { case (ref, res) => assert(ref === res)}*/

View file

@ -37,6 +37,7 @@ class SynchronizationPipe(latch: CountDownLatch) extends Actor with ActorLogging
def exec(script: List[String], a: ActorRef, b: ActorRef): Unit = {
def resolve(x: String) = if (x == "A") a else b
script match {
case offer(x, id, amount, rhash) :: rest =>
resolve(x) ! CMD_ADD_HTLC(amount.toInt, BinaryData(rhash), 144, id = Some(id.toLong))