1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 22:25:26 +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 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 j;
int u = 0; int u = 0;
for (j = 0; j < 17; ++j) for (j = 0; j < 17; ++j) {
{
u += h[j] + c[j]; u += h[j] + c[j];
h[j] = u & 255; h[j] = u & 255;
u >>>= 8; u >>>= 8;
} }
} }
static void squeeze(int[] h) static void squeeze(int[] h) {
{
int u = 0; int u = 0;
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) {
{
u += h[j]; u += h[j];
h[j] = u & 255; h[j] = u & 255;
u >>>= 8; u >>>= 8;
@ -34,8 +30,7 @@ public class Poly3105 {
h[16] = u & 3; h[16] = u & 3;
u = 5 * (u >>> 2); u = 5 * (u >>> 2);
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) {
{
u += h[j]; u += h[j];
h[j] = u & 255; h[j] = u & 255;
u >>>= 8; u >>>= 8;
@ -45,8 +40,7 @@ public class Poly3105 {
h[16] = u; h[16] = u;
} }
static void freeze(int[] h) static void freeze(int[] h) {
{
int[] horig = new int[17]; int[] horig = new int[17];
for (int j = 0; j < 17; ++j) for (int j = 0; j < 17; ++j)
@ -54,18 +48,16 @@ public class Poly3105 {
add(h, minusp); add(h, minusp);
int negative = (int)(-(h[16] >>> 7)); int negative = (int) (-(h[16] >>> 7));
for (int j = 0; j < 17; ++j) for (int j = 0; j < 17; ++j)
h[j] ^= negative & (horig[j] ^ h[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]; int[] hr = new int[17];
for (int i = 0; i < 17; ++i) for (int i = 0; i < 17; ++i) {
{
int u = 0; int u = 0;
for (int j = 0; j <= i; ++j) for (int j = 0; j <= i; ++j)
@ -83,8 +75,7 @@ public class Poly3105 {
squeeze(h); 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 j;
int[] r = new int[17]; int[] r = new int[17];
int[] h = new int[17]; int[] h = new int[17];
@ -111,13 +102,12 @@ public class Poly3105 {
for (j = 0; j < 17; ++j) for (j = 0; j < 17; ++j)
h[j] = 0; h[j] = 0;
while (inlen > 0) while (inlen > 0) {
{
for (j = 0; j < 17; ++j) for (j = 0; j < 17; ++j)
c[j] = 0; c[j] = 0;
for (j = 0; (j < 16) && (j < inlen); ++j) for (j = 0; (j < 16) && (j < inlen); ++j)
c[j] = inv[invoffset + j]&0xff; c[j] = inv[invoffset + j] & 0xff;
c[j] = 1; c[j] = 1;
invoffset += j; invoffset += j;
@ -135,7 +125,7 @@ public class Poly3105 {
add(h, c); add(h, c);
for (j = 0; j < 16; ++j) for (j = 0; j < 16; ++j)
outv[j + outvoffset] = (byte)h[j]; outv[j + outvoffset] = (byte) h[j];
return 0; return 0;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,7 +27,8 @@
<OnMatch>ACCEPT</OnMatch> <OnMatch>ACCEPT</OnMatch>
</filter> </filter>
<encoder> <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> </encoder>
</appender> </appender>
@ -42,13 +43,15 @@
<OnMatch>ACCEPT</OnMatch> <OnMatch>ACCEPT</OnMatch>
</filter> </filter>
<encoder> <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> </encoder>
</appender> </appender>
<logger name="fr.acinq.eclair.channel" level="DEBUG" /> <logger name="fr.acinq.eclair.channel" level="DEBUG"/>
<logger name="fr.acinq.eclair.router" 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.blockchain.peer.PeerClient" level="INFO"/>
<root level="INFO"> <root level="INFO">
<appender-ref ref="CHANNEL"/> <appender-ref ref="CHANNEL"/>

View file

@ -15,7 +15,7 @@ class BinaryDataSerializer extends CustomSerializer[BinaryData](format => ( {
}, { }, {
case x: BinaryData => JString(x.toString()) case x: BinaryData => JString(x.toString())
} }
)) ))
class StateSerializer extends CustomSerializer[State](format => ( { class StateSerializer extends CustomSerializer[State](format => ( {
case JString(x) if (false) => // NOT IMPLEMENTED case JString(x) if (false) => // NOT IMPLEMENTED
@ -23,7 +23,7 @@ class StateSerializer extends CustomSerializer[State](format => ( {
}, { }, {
case x: State => JString(x.toString()) case x: State => JString(x.toString())
} }
)) ))
class ShaChainSerializer extends CustomSerializer[ShaChain](format => ( { class ShaChainSerializer extends CustomSerializer[ShaChain](format => ( {
case JString(x) if (false) => // NOT IMPLEMENTED case JString(x) if (false) => // NOT IMPLEMENTED
@ -31,4 +31,4 @@ class ShaChainSerializer extends CustomSerializer[ShaChain](format => ( {
}, { }, {
case x: ShaChain => JNull 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 * @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] = def sendFromAccount(account: String, destination: String, amount: Double)(implicit ec: ExecutionContext): Future[String] =
client.invoke("sendfrom", account, destination, amount) collect { client.invoke("sendfrom", account, destination, amount) collect {
case JString(txid) => txid case JString(txid) => txid
} }
/** /**
* @param txId * @param txId
@ -133,7 +133,7 @@ class ExtendedBitcoinClient(val client: BitcoinJsonRPCClient) {
* @return the current number of blocks in the active chain * @return the current number of blocks in the active chain
*/ */
def getBlockCount(implicit ec: ExecutionContext): Future[Long] = def getBlockCount(implicit ec: ExecutionContext): Future[Long] =
client.invoke("getblockcount") collect { client.invoke("getblockcount") collect {
case JInt(count) => count.toLong case JInt(count) => count.toLong
} }
} }

View file

@ -10,12 +10,15 @@ import fr.acinq.bitcoin._
import scala.util.{Failure, Success, Try} import scala.util.{Failure, Success, Try}
/** /**
* handles communication with a remote BTC node * 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 * @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 { class PeerHandler(remote: InetSocketAddress, listener: ActorRef) extends Actor with ActorLogging {
import akka.io.Tcp._ import akka.io.Tcp._
implicit val system = context.system implicit val system = context.system
context.watch(listener) 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. * 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 * It allows to reference the using {{{system.actorSelection()}}} with a meaningful name
*
* @param origin aliased actor * @param origin aliased actor
*/ */
class AliasActor(origin: ActorRef) extends Actor with ActorLogging { 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)) => case Event((anchorTx: Transaction, anchorOutputIndex: Int), DATA_WAIT_FOR_FUNDING_INTERNAL(temporaryChannelId, channelParams, pushMsat, remoteFirstPerCommitmentPoint)) =>
log.info(s"anchor txid=${anchorTx.txid}") 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 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 val ourSigForThem: BinaryData = ??? // signature of their initial commitment tx that pays them pushMsat
them ! FundingCreated( them ! FundingCreated(
temporaryChannelId = temporaryChannelId, 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 ! 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) 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 ourTx: Transaction = ??? // makeOurTx(ourParams, theirParams, TxIn(OutPoint(anchorTxHash, anchorOutputIndex), Array.emptyByteArray, 0xffffffffL) :: Nil, ourRevocationHash, ourSpec)
val commitments = Commitments(channelParams.localParams, channelParams.remoteParams, 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) val ourTx = makeLocalTx(channelParams.localParams, channelParams.remoteParams, TxIn(OutPoint(anchorTx, anchorOutputIndex), Array.emptyByteArray, 0xffffffffL) :: Nil, ourRevocationHash, ourSpec)
log.info(s"checking our tx: $ourTx") log.info(s"checking our tx: $ourTx")
val ourSig = sign(channelParams.localParams, channelParams.remoteParams, anchorAmount, 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) val anchorOutput: TxOut = ??? //anchorTx.txOut(anchorOutputIndex)
checksig(channelParams.localParams, channelParams.remoteParams, anchorOutput, signedTx) match { checksig(channelParams.localParams, channelParams.remoteParams, anchorOutput, signedTx) match {
case Failure(cause) => 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 => case Event(CMD_SIGN, d: DATA_SHUTDOWN) if d.commitments.remoteNextCommitInfo.isLeft =>
//TODO : this is a temporary fix //TODO : this is a temporary fix
log.info(s"already in the process of signing, delaying CMD_SIGN") 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) context.system.scheduler.scheduleOnce(100 milliseconds, self, CMD_SIGN)
stay stay
@ -706,7 +708,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, paymentHandler: Acto
stay stay
case Event(CMD_GETINFO, _) => 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_OPEN_CHANNEL => 0L
case c: DATA_WAIT_FOR_ACCEPT_CHANNEL => c.temporaryChannelId case c: DATA_WAIT_FOR_ACCEPT_CHANNEL => c.temporaryChannelId
case c: DATA_WAIT_FOR_FUNDING_CREATED => 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") log.warning(s"txid=${tx.txid} was a revoked commitment, publishing the punishment tx")
them ! Error(0, "Anchor has been spent".getBytes) them ! Error(0, "Anchor has been spent".getBytes)
blockchain ! Publish(spendingTx) 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 { val nextData = d match {
case closing: DATA_CLOSING => closing.copy(revokedPublished = closing.revokedPublished :+ tx) case closing: DATA_CLOSING => closing.copy(revokedPublished = closing.revokedPublished :+ tx)
case _ => DATA_CLOSING(d.commitments, revokedPublished = Seq(tx)) case _ => DATA_CLOSING(d.commitments, revokedPublished = Seq(tx))

View file

@ -71,7 +71,7 @@ object Register {
* which name is counterparty_id-anchor_id * which name is counterparty_id-anchor_id
*/ */
def create_alias(node_id: BinaryData, anchor_id: BinaryData)(implicit context: ActorContext) = 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 = def actorPathToNodeId(system: ActorSystem, nodeId: BinaryData): ActorPath =
system / "register" / "auth-handler-*" / "channel" / s"${nodeId}-*" system / "register" / "auth-handler-*" / "channel" / s"${nodeId}-*"

View file

@ -10,15 +10,19 @@ import fr.acinq.eclair.transactions._
*/ */
object Scripts { object Scripts {
def toSelfDelay2csv(in: Int): Long = ??? /*in match { def toSelfDelay2csv(in: Int): Long = ???
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 { /*in match {
case locktime(Blocks(blocks)) => blocks case locktime(Blocks(blocks)) => blocks
case locktime(Seconds(seconds)) => seconds 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 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 sequence & TxIn.SEQUENCE_LOCKTIME_MASK
} }
} }
if (tx.version < 2) 0 if (tx.version < 2) 0
else tx.txIn.map(_.sequence).map(sequenceToBlockHeight).max 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) case class Encryptor(key: BinaryData, nonce: Long)
object Encryptor { 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 header = Protocol.writeUInt32(data.length)
val (ciphertext1, mac1) = AeadChacha20Poly1305.encrypt(encryptor.key, Protocol.writeUInt64(encryptor.nonce), header, Array.emptyByteArray) 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) 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 { 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 size = clientPrivateKeys.length
val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i))) val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i)))
var padding: BinaryData = Array.empty[Byte] var padding: BinaryData = Array.empty[Byte]
@ -35,14 +35,14 @@ object Onion extends App {
unsigned ++ hmac(secrets.last)(unsigned) 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 encrypted = encMsg(secret)(nextMessage.drop(192) ++ plaintext)
val pub: BinaryData = Crypto.publicKeyFromPrivateKey(clientPrivateKey :+ 1.toByte) val pub: BinaryData = Crypto.publicKeyFromPrivateKey(clientPrivateKey :+ 1.toByte)
val unsigned = encrypted ++ pub.drop(1) val unsigned = encrypted ++ pub.drop(1)
unsigned ++ hmac(secret)(unsigned) 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 size = clientPrivateKeys.length
val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i))) val secrets = for (i <- 0 until size) yield generate_secrets(ecdh(nodePublicKeys(i), clientPrivateKeys(i)))
val lastMessage = makeLastMessage(clientPrivateKeys, nodePublicKeys, plaintext) val lastMessage = makeLastMessage(clientPrivateKeys, nodePublicKeys, plaintext)
@ -64,7 +64,7 @@ object Onion extends App {
val sig2 = hmac256(secrets.hmac_key, buf.dropRight(32)) val sig2 = hmac256(secrets.hmac_key, buf.dropRight(32))
if (!sig.data.sameElements(sig2.data)) throw new RuntimeException("sig mismatch!") 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 payload = decrypted.takeRight(128)
val payloadstring = new String(payload.toArray) val payloadstring = new String(payload.toArray)
val newmsg = aesEncrypt(Array.fill[Byte](192)(0x00), secrets.aes_key, secrets.pad_iv) ++ decrypted.dropRight(128) 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. * 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 { class NamedEdge(val id: BinaryData) extends DefaultEdge {
override def toString: String = s"${id.toString.take(8)}..." override def toString: String = s"${id.toString.take(8)}..."
} }
val graph = new SimpleGraph[BinaryData, NamedEdge](classOf[NamedEdge]) val graph = new SimpleGraph[BinaryData, NamedEdge](classOf[NamedEdge])
graph.addVertex(Globals.Node.publicKey) 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 = { @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 = { def positionAtCenter(childStage: Stage): Unit = {

View file

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

View file

@ -15,26 +15,27 @@ import scala.util.{Success, Try}
/** /**
* Created by DPA on 23/09/2016. * 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 amount: TextField = _
@FXML var amountError:Label = _ @FXML var amountError: Label = _
// this field is generated and readonly // 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)) { if (GUIValidators.validate(amount.getText, amountError, GUIValidators.amountRegex)) {
Try(amount.getText.toLong) match { Try(amount.getText.toLong) match {
case Success (amountMsat) => handlers.getPaymentRequest(amount.getText.toLong, paymentRequest) case Success(amountMsat) => handlers.getPaymentRequest(amount.getText.toLong, paymentRequest)
case _ => {} case _ => {}
} }
} }
} }
@FXML def handleClose (event: ActionEvent): Unit = {
@FXML def handleClose(event: ActionEvent): Unit = {
stage.close() stage.close()
} }
} }

View file

@ -15,15 +15,15 @@ import grizzled.slf4j.Logging
/** /**
* Created by DPA on 23/09/2016. * 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 paymentRequest: TextArea = _
@FXML var paymentRequestError:Label = _ @FXML var paymentRequestError: Label = _
@FXML var nodeIdLabel:Label = _ @FXML var nodeIdLabel: Label = _
@FXML var amountLabel:Label = _ @FXML var amountLabel: Label = _
@FXML var hashLabel:Label = _ @FXML var hashLabel: Label = _
@FXML def initialize (): Unit = { @FXML def initialize(): Unit = {
paymentRequest.textProperty().addListener(new ChangeListener[String] { paymentRequest.textProperty().addListener(new ChangeListener[String] {
def changed(observable: ObservableValue[_ <: String], oldValue: String, newValue: String): Unit = { 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)) { if (GUIValidators.validate(paymentRequest.getText, paymentRequestError, GUIValidators.paymentRequestRegex)) {
val Array(nodeId, amount, hash) = paymentRequest.getText.split(":") val Array(nodeId, amount, hash) = paymentRequest.getText.split(":")
handlers.send(nodeId, hash, amount) 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() stage.close()
} }
} }

View file

@ -12,7 +12,7 @@ import fr.acinq.eclair.gui.controllers.OpenChannelController
/** /**
* Created by PM on 16/08/2016. * 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) initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED) initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false)) 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. * 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) initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED) initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false)) 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. * 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) initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED) initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair02.png", false)) 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. * Builds a Context Menu with a single Copy action.
*
* @param valueToCopy the value to copy to clipboard * @param valueToCopy the value to copy to clipboard
* @return javafx context menu * @return javafx context menu
*/ */

View file

@ -21,6 +21,7 @@ class LocalPaymentHandler extends Actor with ActorLogging {
random.nextBytes(r) random.nextBytes(r)
r r
} }
override def receive: Receive = run(Map()) override def receive: Receive = run(Map())
//TODO: store this map on file ? //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") log.info(s"removed channel ${c.id} from available routes")
context become main(channels - c.id) context become main(channels - c.id)
case 'network => sender ! channels.values 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 = ??? def makeLocalTxTemplate(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], ourRevocationHash: BinaryData, spec: CommitmentSpec): CommitTxTemplate = ???
//makeCommitTxTemplate(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec) //makeCommitTxTemplate(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec)
def makeLocalTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], ourRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ??? def makeLocalTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], ourRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ???
//makeCommitTx(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec) //makeCommitTx(inputs, ourParams.finalPubKey, theirParams.finalPubKey, ourParams.delay, ourRevocationHash, spec)
def makeRemoteTxTemplate(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): CommitTxTemplate = ??? def makeRemoteTxTemplate(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): CommitTxTemplate = ???
//makeCommitTxTemplate(inputs, theirParams.finalPubKey, ourParams.finalPubKey, theirParams.delay, theirRevocationHash, spec) //makeCommitTxTemplate(inputs, theirParams.finalPubKey, ourParams.finalPubKey, theirParams.delay, theirRevocationHash, spec)
def makeRemoteTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ??? def makeRemoteTx(localParams: LocalParams, RemoteParams: RemoteParams, inputs: Seq[TxIn], theirRevocationHash: BinaryData, spec: CommitmentSpec): Transaction = ???
//makeTheirTxTemplate(ourParams, theirParams, inputs, theirRevocationHash, spec).makeTx //makeTheirTxTemplate(ourParams, theirParams, inputs, theirRevocationHash, spec).makeTx
} }

View file

@ -11,14 +11,17 @@ import scala.util.Try
object Signature { object Signature {
def sign(localParams: LocalParams, RemoteParams: RemoteParams, anchorAmount: Satoshi, tx: Transaction): BinaryData = ??? 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)) //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 = ??? /*{ 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) // TODO : Transaction.sign(...) should handle multisig
tx.updateWitness(0, witness) 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] = 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)) 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 signature: BinaryData) extends ChannelMessage
case class UpdateAddHtlc(channelId: Long, case class UpdateAddHtlc(channelId: Long,
id: Long, id: Long,
amountMsat: Long, amountMsat: Long,
expiry: Long, expiry: Long,
paymentHash: BinaryData, paymentHash: BinaryData,
onionRoutingPacket: BinaryData) extends HtlcMessage with UpdateMessage onionRoutingPacket: BinaryData) extends HtlcMessage with UpdateMessage
case class UpdateFulfillHtlc(channelId: Long, case class UpdateFulfillHtlc(channelId: Long,
id: Long, id: Long,

View file

@ -95,7 +95,7 @@ object NewChannel extends App {
val pipe = system.actorOf(Props(new TestPipe())) val pipe = system.actorOf(Props(new TestPipe()))
val a = system.actorOf(Props(new ChannelMock(pipe)), name = "a") val a = system.actorOf(Props(new ChannelMock(pipe)), name = "a")
val b = system.actorOf(Props(new ChannelMock(pipe)), name = "b") 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 exec(script: List[String], a: ActorRef, b: ActorRef): Unit = {
def resolve(x: String) = if (x == "A") a else b def resolve(x: String) = if (x == "A") a else b
script match { script match {
case offer(x, i) :: rest => case offer(x, i) :: rest =>
resolve(x) ! CmdOffer(i.toInt) 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" Offered htlcs: ${my_commit.selected.filter(_ % 2 != even).mkString(" ")}",
s" Received 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" Fee level ${my_commit.fee_level}",
s" SIGNED").filterNot(_ == " Fee level 0") // TODO ??? s" SIGNED").filterNot(_ == " Fee level 0")
def rtrim(s: String) = s.replaceAll("\\s+$", "")
// TODO ???
def rtrim(s: String) = s.replaceAll("\\s+$", "")
l.foreach(s => { l.foreach(s => {
fout.write(rtrim(s)) fout.write(rtrim(s))
fout.newLine() fout.newLine()

View file

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

View file

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

View file

@ -16,6 +16,7 @@ import scala.concurrent.{ExecutionContext, Future}
class TestBitcoinClient()(implicit system: ActorSystem) extends ExtendedBitcoinClient(new BitcoinJsonRPCClient("", "", "", 0)) { class TestBitcoinClient()(implicit system: ActorSystem) extends ExtendedBitcoinClient(new BitcoinJsonRPCClient("", "", "", 0)) {
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
system.scheduler.schedule(100 milliseconds, 100 milliseconds, new Runnable { system.scheduler.schedule(100 milliseconds, 100 milliseconds, new Runnable {
override def run(): Unit = system.eventStream.publish(NewBlock(null)) // blocks are not actually interpreted 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 { object TestConstants {
val anchorAmount = 1000000L 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 // 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 ourTx: Transaction = ??? // Helpers.makeOurTx(channelParams, TheirChannelParams(Alice.channelParams), TxIn(OutPoint(Hash.One, 0), Array.emptyByteArray, 0xffffffffL) :: Nil, revocationHash(0), ourSpec)
val commitments: Commitments = ???/*Commitments( val commitments: Commitments = ???
Bob.channelParams, /*Commitments(
TheirChannelParams(Alice.channelParams), Bob.channelParams,
OurCommit(0, ourSpec, ourTx), TheirCommit(0, theirSpec, BinaryData(""), Alice.revocationHash(0)), TheirChannelParams(Alice.channelParams),
OurChanges(Nil, Nil, Nil), TheirChanges(Nil, Nil), 0L, OurCommit(0, ourSpec, ourTx), TheirCommit(0, theirSpec, BinaryData(""), Alice.revocationHash(0)),
Right(Alice.revocationHash(1)), anchorOutput, ShaChain.init, new BasicTxDb)*/ 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]) @RunWith(classOf[JUnitRunner])
class HelpersSpec extends FunSuite { class HelpersSpec extends FunSuite {
test("add, fulfill and fail htlcs") { test("add, fulfill and fail htlcs") {
val spec = CommitmentSpec(Set(), 1000, 2000 * 1000, 0) val spec = CommitmentSpec(Set(), 1000, 2000 * 1000, 0)
val R1 = Crypto.sha256("foo".getBytes()) val R1 = Crypto.sha256("foo".getBytes())
val H1 = Crypto.sha256(R1) val H1 = Crypto.sha256(R1)
val R2 = Crypto.sha256("bar".getBytes()) val R2 = Crypto.sha256("bar".getBytes())
val H2 = Crypto.sha256(R2) val H2 = Crypto.sha256(R2)
val ours1 = UpdateAddHtlc(0, 1, 1000, 400, H1, "") val ours1 = UpdateAddHtlc(0, 1, 1000, 400, H1, "")
val spec1 = CommitmentSpec.reduce(spec, ours1 :: Nil, Nil) 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.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_local_msat == spec.to_local_msat - ours1.amountMsat)
assert(spec1.to_remote_msat == spec.to_remote_msat) assert(spec1.to_remote_msat == spec.to_remote_msat)
assert(spec1.totalFunds == spec.totalFunds) assert(spec1.totalFunds == spec.totalFunds)
val theirs1 = UpdateFulfillHtlc(0, ours1.id, R1) val theirs1 = UpdateFulfillHtlc(0, ours1.id, R1)
val spec2 = CommitmentSpec.reduce(spec1, Nil, theirs1 :: Nil) val spec2 = CommitmentSpec.reduce(spec1, Nil, theirs1 :: Nil)
assert(spec2.htlcs.isEmpty && spec2.to_remote_msat == 1000 && spec2.totalFunds == spec.totalFunds) assert(spec2.htlcs.isEmpty && spec2.to_remote_msat == 1000 && spec2.totalFunds == spec.totalFunds)
val theirs2 = UpdateAddHtlc(0, 2, 1000, 400, H2, "") val theirs2 = UpdateAddHtlc(0, 2, 1000, 400, H2, "")
val spec3 = CommitmentSpec.reduce(spec2, Nil, theirs2 :: Nil) val spec3 = CommitmentSpec.reduce(spec2, Nil, theirs2 :: Nil)
assert(spec3.htlcs.size == 1) assert(spec3.htlcs.size == 1)
assert(spec3.to_local_msat == spec2.to_local_msat) assert(spec3.to_local_msat == spec2.to_local_msat)
assert(spec3.to_remote_msat == spec2.to_remote_msat - theirs2.amountMsat) assert(spec3.to_remote_msat == spec2.to_remote_msat - theirs2.amountMsat)
assert(spec3.totalFunds == spec.totalFunds) assert(spec3.totalFunds == spec.totalFunds)
val ours2 = UpdateFailHtlc(0, theirs2.id, "") val ours2 = UpdateFailHtlc(0, theirs2.id, "")
val spec4 = CommitmentSpec.reduce(spec3, ours2 :: Nil, Nil) val spec4 = CommitmentSpec.reduce(spec3, ours2 :: Nil, Nil)
assert(spec4 == spec2) assert(spec4 == spec2)
} }
} }

View file

@ -100,7 +100,7 @@ class NominalChannelSpec extends BaseChannelTestClass {
case d: DATA_NORMAL => case d: DATA_NORMAL =>
assert(d.commitments.localCommit.spec.htlcs.isEmpty) assert(d.commitments.localCommit.spec.htlcs.isEmpty)
assert(d.commitments.localCommit.spec.to_local_msat == 60000000) 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 // send another HTLC

View file

@ -14,7 +14,7 @@ import scala.concurrent.duration._
class StealChannelSpec extends BaseChannelTestClass { class StealChannelSpec extends BaseChannelTestClass {
test("steal revoked commit tx") { case (alice, bob, pipe) => 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) { within(30 seconds) {
@ -41,7 +41,7 @@ class StealChannelSpec extends BaseChannelTestClass {
alice ! CMD_SIGN alice ! CMD_SIGN
Thread.sleep(500) Thread.sleep(500)
bob !(BITCOIN_FUNDING_SPENT, commitTx) bob ! (BITCOIN_FUNDING_SPENT, commitTx)
awaitCond(bob.stateName == CLOSING) awaitCond(bob.stateName == CLOSING)
} }
} }

View file

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

View file

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

View file

@ -19,7 +19,7 @@ class LightningCryptoSpec extends FunSuite {
} }
test("Chacha20") { 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 key: BinaryData = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
val nonce: BinaryData = "0000004a00000000" val nonce: BinaryData = "0000004a00000000"

View file

@ -55,7 +55,7 @@ class OnionSpec extends FunSuite {
"d93db8019a9392b3df11929896639ab1a069a0096e3defa595af16544957526b" "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( val node_keys: List[(BinaryData, BinaryData)] = List(
("665af9917fbbd9758fd53352275f9b555296ee16e20a73a069931959c0980935", "0204053aed6a50fd4062331fc951d5da830ba64c02bfd7a64571fe16a7c46befa8"), ("665af9917fbbd9758fd53352275f9b555296ee16e20a73a069931959c0980935", "0204053aed6a50fd4062331fc951d5da830ba64c02bfd7a64571fe16a7c46befa8"),

View file

@ -21,7 +21,7 @@ class RustyTestsMockSpec extends TestKit(ActorSystem("test")) with Matchers with
val pipe: TestActorRef[TestPipe] = TestActorRef[TestPipe] val pipe: TestActorRef[TestPipe] = TestActorRef[TestPipe]
val alice: TestFSMRef[StateMock, DataMock, ChannelMock] = TestFSMRef(new ChannelMock(pipe)) val alice: TestFSMRef[StateMock, DataMock, ChannelMock] = TestFSMRef(new ChannelMock(pipe))
val bob: 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) awaitCond(pipe.underlying.isTerminated, 30 seconds)
val ref = Source.fromFile(new File(s"rusty-scripts/${test.name}.script.expected")).getLines().filterNot(_.startsWith("#")).toList 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 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) TestKit.shutdownActorSystem(system)
} }
test("01-offer1") { 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("02-offer2") { case (ref, res) => assert(ref === res) }
test("03-fulfill1") { 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("04-two-commits-onedir") { case (ref, res) => assert(ref === res) }
test("05-two-commits-in-flight") { 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("10-offers-crossover") { case (ref, res) => assert(ref === res) }
test("11-commits-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("13-fee") { case (ref, res) => assert(ref === res) }
test("14-fee-twice") { 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("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 paymentHandler = system.actorOf(Props(new NoopPaymentHandler()))
val alice: TestFSMRef[State, Data, Channel] = TestFSMRef(new Channel(pipe, blockchainA, paymentHandler, Alice.channelParams, "B")) 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")) val bob: TestFSMRef[State, Data, Channel] = TestFSMRef(new Channel(pipe, blockchainB, paymentHandler, Bob.channelParams, "A"))
pipe !(alice, bob) pipe ! (alice, bob)
within(30 seconds) { within(30 seconds) {
awaitCond(alice.stateName == NORMAL) awaitCond(alice.stateName == NORMAL)
awaitCond(bob.stateName == NORMAL) awaitCond(bob.stateName == NORMAL)
@ -49,13 +49,13 @@ class RustyTestsSpec extends TestKit(ActorSystem("test")) with Matchers with fix
TestKit.shutdownActorSystem(system) TestKit.shutdownActorSystem(system)
} }
test("01-offer1") { 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("02-offer2") { case (ref, res) => assert(ref === res) }
test("03-fulfill1") { 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("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("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("10-offers-crossover") { case (ref, res) => assert(ref === res) }
test("11-commits-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("13-fee") { case (ref, res) => assert(ref === res)}
test("14-fee-twice") { 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("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 exec(script: List[String], a: ActorRef, b: ActorRef): Unit = {
def resolve(x: String) = if (x == "A") a else b def resolve(x: String) = if (x == "A") a else b
script match { script match {
case offer(x, id, amount, rhash) :: rest => case offer(x, id, amount, rhash) :: rest =>
resolve(x) ! CMD_ADD_HTLC(amount.toInt, BinaryData(rhash), 144, id = Some(id.toLong)) resolve(x) ! CMD_ADD_HTLC(amount.toInt, BinaryData(rhash), 144, id = Some(id.toLong))