Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #211 from nayutaco/peer_conf_name
Browse files Browse the repository at this point in the history
set peer.conf name
  • Loading branch information
nayuta-ueno authored Feb 18, 2018
2 parents 2199865 + 16ac17b commit 999479b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
6 changes: 6 additions & 0 deletions install/2nodes_test/example_st2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ cd node_3333
cd ../node_4444
../ucoind -c ../regtest.conf -p 4444 &
cd ..

sleep 1

mkdir -p conf
mv node_3333/peer_*.conf conf/peer3333.conf
mv node_4444/peer_*.conf conf/peer4444.conf
4 changes: 0 additions & 4 deletions install/2nodes_test/example_st3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# +-----------+ | fundee |
# +-----------+

mkdir -p conf
cp node_3333/peer.conf conf/peer3333.conf
cp node_4444/peer.conf conf/peer4444.conf

# connect
./ucoincli -c conf/peer3333.conf 4445

Expand Down
6 changes: 3 additions & 3 deletions install/2nodes_test/example_st4r.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ PAYEE=node_${PAY_END}
PAYEE_PORT=$(( ${PAY_END} + 1 ))

nodeid() {
cat $1/peer.conf | awk '(NR==3) { print $1 }' | cut -d '=' -f2
cat conf/peer$1.conf | awk '(NR==3) { print $1 }' | cut -d '=' -f2
}

pay() {
echo "payment ${PAYER} --> ${PAYEE}"

payer_id=`nodeid $PAYER`
payee_id=`nodeid $PAYEE`
payer_id=`nodeid $PAY_BEGIN`
payee_id=`nodeid $PAY_END`

./routing $PAYER/dbucoin $payer_id $payee_id $AMOUNT
if [ $? -ne 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions install/4nodes_test/example_st2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ cd ../node_5555
cd ../node_6666
../ucoind -c ../regtest.conf -p 6666 &
cd ..

sleep 3

mkdir -p conf
mv node_3333/peer_*.conf conf/peer3333.conf
mv node_4444/peer_*.conf conf/peer4444.conf
mv node_5555/peer_*.conf conf/peer5555.conf
mv node_6666/peer_*.conf conf/peer6666.conf
6 changes: 0 additions & 6 deletions install/4nodes_test/example_st3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@
# | fundee +-------------+ FUNDER |
# +-----------+ +-----------+

mkdir -p conf
cp node_3333/peer.conf conf/peer3333.conf
cp node_4444/peer.conf conf/peer4444.conf
cp node_5555/peer.conf conf/peer5555.conf
cp node_6666/peer.conf conf/peer6666.conf

# connect
./ucoincli -c conf/peer3333.conf 4445
sleep 1
Expand Down
6 changes: 3 additions & 3 deletions install/4nodes_test/example_st4r.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ PAYEE_PORT=$(( ${PAY_END} + 1 ))


nodeid() {
cat $1/peer.conf | awk '(NR==3) { print $1 }' | cut -d '=' -f2
cat conf/peer$1.conf | awk '(NR==3) { print $1 }' | cut -d '=' -f2
}

pay() {
echo "payment ${PAYER} --> ${PAYEE}"

payer_id=`nodeid $PAYER`
payee_id=`nodeid $PAYEE`
payer_id=`nodeid $PAY_BEGIN`
payee_id=`nodeid $PAY_END`

./routing $PAYER/dbucoin $payer_id $payee_id $AMOUNT
if [ $? -ne 0 ]; then
Expand Down
4 changes: 3 additions & 1 deletion ucoind/ucoind.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ int main(int argc, char *argv[])
ln_print_node(&mNode);

//peer config出力
FILE *fp = fopen("peer.conf", "w");
char fname[256];
sprintf(fname, "peer_%s.conf", mNode.alias);
FILE *fp = fopen(fname, "w");
if (fp) {
if (p_addr->type == LN_NODEDESC_IPV4) {
fprintf(fp, "ipaddr=%d.%d.%d.%d\n",
Expand Down

0 comments on commit 999479b

Please sign in to comment.