I started lightningd in regtest mode once, stopped it, stopped bitcoind, switched bitcoind to testnet, and attempted to start lightningd in testnet mode and I get this error
$ bitcoind
Bitcoin server starting
chris@chris:~/dev/gentle-hollows-6489$ lightningd --network=testnet
2018-07-27T17:53:58.555Z lightningd(13152): Wallet blockchain hash does not match network blockchain hash: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 != 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
lightningd: Wallet network check failed.
chris@chris:~/dev/gentle-hollows-6489$ bitcoin-cli getblockchaininfo
{
"chain": "test",
"blocks": 1355736,
"headers": 1355736,
"bestblockhash": "000000000000000a7719f13e8c9e67ca3250acb7ea9a3d442306f50d93197c97",
"difficulty": 58358570.79038175,
"mediantime": 1532710533,
"verificationprogress": 0.9999985229509308,
"initialblockdownload": false,
"chainwork": "00000000000000000000000000000000000000000000007a32b106812aeeb631",
"size_on_disk": 14448434319,
"pruned": false,
"softforks": [
{
"id": "bip34",
"version": 2,
"reject": {
"status": true
}
},
{
"id": "bip66",
"version": 3,
"reject": {
"status": true
}
},
{
"id": "bip65",
"version": 4,
"reject": {
"status": true
}
}
],
"bip9_softforks": {
"csv": {
"status": "active",
"startTime": 1456790400,
"timeout": 1493596800,
"since": 770112
},
"segwit": {
"status": "active",
"startTime": 1462060800,
"timeout": 1493596800,
"since": 834624
}
},
"warnings": "Warning: unknown new rules activated (versionbit 28)"
}
My lightning config file:
$ cat ~/.lightning/config
alias=suredbits-client
rgb=008000
network=testnet
addr=localhost:9737
That is because the wallet was created by starting lightningd --network=regtest (the blockhash 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 is the genesis hash for regtest). Either delete the lightningd.sqlite3 file, or specify another --lightning-dir where the new wallet will be created (don't forget to copy over the config).
It would be nice if functionality was similar to bitcoin core's here, if someone wants to tackle this in the future! :-).
We're a bit of unsure about this point: lightning nodes can technically be run on multiple currencies (which allows atomic swaps for example), but c-lightning currently doesn't support that. So if we split this up now, we'll have a hard time later. If we don't people will continue running into this issue.
Most helpful comment
That is because the wallet was created by starting
lightningd --network=regtest(the blockhash0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206is the genesis hash for regtest). Either delete thelightningd.sqlite3file, or specify another--lightning-dirwhere the new wallet will be created (don't forget to copy over the config).