Bitcoin Forum

Bitcoin => Armory => Topic started by: bobulus on September 05, 2018, 08:03:53 PM



Title: ArmoryDB standalone doesn't connect to bitcoin node
Post by: bobulus on September 05, 2018, 08:03:53 PM
I'm having an issue when running ArmoryDB directly, (without the GUI so I can use armoryd.py). ArmoryDB appears to never connects to the bitcoin node. Running with the following command:

ArmoryDB --datadir=/armory

If you look at my Direct - dbLog.txt, you'll notice it just stops after "Listening on port 19002". When running from the GUI, it connects to the bitcoin node fine. With the GUI - dbLog.txt, it continues with "Executing: doInitialSyncOnLoad". Am I misconfiguring something? How do I get ArmoryDB to connect to my bitcoin node when running ArmoryDB directly?

Armory 0.96.4
Bitcoin Core 0.16.2 running regtest

Later when I'm running armoryd.py I get the error "DB error: Magic bytes mismatch!  Different blokchain?", but I believe it's because ArmoryDB never connected to my bitcoin node. (armoryd.py works fine when I run Armory from the GUI too).

armorydb.conf
Code:
satoshi-datadir=/bitcoin/regtest/blocks
satoshi-port=18333
regtest
fcgi-port=19002
cookie
db-type=DB_FULL

BAD - Direct - dbLog.txt
Code:
Log file opened at 19:30:00: /armory/dbLog.txt
-INFO  - 19:30:00: (main.cpp:32) Running on 4 threads
-INFO  - 19:30:00: (main.cpp:33) Ram usage level: 50
-INFO  - 19:30:00: (BlockUtils.cpp:915) blkfile dir: /bitcoin/regtest/blocks
-INFO  - 19:30:00: (BlockUtils.cpp:916) lmdb dir: /armory/databases
-INFO  - 19:30:00: (lmdb_wrapper.cpp:388) Opening databases...
-INFO  - 19:30:00: (BDM_Server.h:263) Listening on port 19002
## LOG STOPS HERE ##

GOOD - GUI - dbLog.txt
Code:
Log file opened at 18:39:13: /armory/dbLog.txt
-INFO  - 18:39:13: (main.cpp:32) Running on 4 threads
-INFO  - 18:39:13: (main.cpp:33) Ram usage level: 50
-INFO  - 18:39:13: (BlockUtils.cpp:915) blkfile dir: /bitcoin/regtest/blocks
-INFO  - 18:39:13: (BlockUtils.cpp:916) lmdb dir: /armory/databases
-INFO  - 18:39:13: (lmdb_wrapper.cpp:388) Opening databases...
-INFO  - 18:39:13: (BDM_Server.h:263) Listening on port 19002
-INFO  - 18:39:13: (BlockUtils.cpp:1108) Executing: doInitialSyncOnLoad
-INFO  - 18:39:13: (BitcoinP2P.cpp:947) Connected to Bitcoin node
-INFO  - 18:39:13: (DatabaseBuilder.cpp:199) Reading headers from db
-INFO  - 18:39:13: (DatabaseBuilder.cpp:238) Found 102 headers in db
-INFO  - 18:39:13: (DatabaseBuilder.cpp:64) Rewinding 100 blocks
-INFO  - 18:39:13: (DatabaseBuilder.cpp:71) updating HEADERS db
-INFO  - 18:39:13: (DatabaseBuilder.cpp:493) Found next block after skipping 254bytes
## log continues ##


Title: Re: ArmoryDB standalone doesn't connect to bitcoin node
Post by: bobulus on September 06, 2018, 05:12:15 PM
After browsing the C++ code, I decided to try passing in configuration via the command line instead of the config file, and it worked. It seems like either my config file is incorrect, or maybe bug in how ArmoryDB parses armorydb.conf. When I have a chance I'll go back and debug a bit.


Title: Re: ArmoryDB standalone doesn't connect to bitcoin node
Post by: bob123 on September 08, 2018, 09:33:49 AM
It seems like either my config file is incorrect, [...]

That's what i am assuming.

If i recall correctly you need to put the path between " ".


So, the first line of your armorydb.conf should be:
Code:
satoshi-datadir="/bitcoin/regtest/blocks"

instead of
Code:
satoshi-datadir=/bitcoin/regtest/blocks


Also, are you sure the absolute path /bitcoin/* is correct ?


Title: Re: ArmoryDB standalone doesn't connect to bitcoin node
Post by: goatpig on September 09, 2018, 09:02:10 AM
Quote
I'm having an issue when running ArmoryDB directly, (without the GUI so I can use armoryd.py). ArmoryDB appears to never connects to the bitcoin node. Running with the following command:

ArmoryDB --datadir=/armory

You have to start it in regtest:

Code:
ArmoryDB --datadir=/armory --regtest


Title: Re: ArmoryDB standalone doesn't connect to bitcoin node
Post by: bobulus on September 09, 2018, 11:06:22 PM
You have to start it in regtest:

Does it not work when setting regtest via armorydb.conf for ArmoryDB? It works when running the GUI, with setting regest in the conf file:

Code:
armory --datadir=/armory

I'm using the same conf file for both.


Title: Re: ArmoryDB standalone doesn't connect to bitcoin node
Post by: goatpig on September 11, 2018, 12:14:16 AM
Quote
Does it not work when setting regtest via armorydb.conf for ArmoryDB? It works when running the GUI, with setting regest in the conf file:

When called from the GUI, the DB is spawned with --regtest. Browse armorylog.txt, you should see the db invocation with the relevant arg.

Quote
I'm using the same conf file for both.

CLI args overrule the config file. The way it works is the arguments are tokenized and inserted into a map. Then the content of the config file is loaded and passed through the same process. Any insertion of an existing key into the token map will be ignored as per std::map mechanics.

This means most everything in your db config file will be ignored when spawning from the GUI as it passes a pretty exhaustive list of arguments.