---
# System prepended metadata

title: Аудит финализации

---

# Аудит финализации

# ветка: v0.5_state-finalize


## 1) Блок создается со стейтом

````sh
1) Блок создается со стейтом

INFO [11-01|17:18:35.149] Creator start                            c.newTaskHook=false c.skipSealHook=false
INFO [11-01|17:18:35.150] Block parent hashes                      hash=0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1 ParentHashes=[0x35bcd448e3cccb5b69e8e89c9bc9161aee5018e1e7b8023c097e53e2f21d4c24]
INFO [11-01|17:18:35.150] Block received root                      root=0xecf02b792ebd7cee5e1a63ef758cfe0b06129abc682c11b7d6a8fb4cf005bf5a hash=0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1
INFO [11-01|17:18:35.150] Block committed root                     root=0xecf02b792ebd7cee5e1a63ef758cfe0b06129abc682c11b7d6a8fb4cf005bf5a height=4 Nr=0 kind=WriteMinedBlock
INFO [11-01|17:18:35.150] Persisted trie from memory database      nodes=4 size=752.00B time="105.234µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [11-01|17:18:35.150] <<<<<< c.chain.AddTips(newBlockDag) >>>>>> tips="{\"0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1\":{\"Hash\":\"0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1\",\"Height\":4,\"Slot\":4,\"LastFinalizedHash\":\"0x85de8ee6ea1860037e85d4c2cf2d678c1d9ced98dca9d7621ae640d42ef443c8\",\"LastFinalizedHeight\":2,\"DagChainHashes\":[\"0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545\",\"0x35bcd448e3cccb5b69e8e89c9bc9161aee5018e1e7b8023c097e53e2f21d4c24\"]}}"
INFO [11-01|17:18:35.150] Successfully sealed new block            slot=4 height=4 hash=0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1 sealhash=9d5551..35c5fb elapsed=1.230ms
INFO [11-01|17:18:35.150] 🔨 created dag block                      slot=4 height=4 hash=0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1 parents=[0x35bcd448e3cccb5b69e8e89c9bc9161aee5018e1e7b8023c097e53e2f21d4c24]
INFO [11-01|17:18:35.150] HandleConsensus: create block            dagSlots=1 IsRunning=true crtInfo=map[newBlock:0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1] elapsed=2.012ms
INFO [11-01|17:18:35.150] Move to processing list                  TX hash=9f8bce..6eb4c3 TX nonce=3
INFO [11-01|17:18:35.150] Announced block                          hash=0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1 recipients=0 duration=150.685ms

> 
> 
> eth.getBalance(eth.accounts[0],"0x00a635ce4d29b2ba1aca18c10bfeb30330a84d649a2dc7773b66635a3c579de1")
9.99999999999999999959931091915167e+35
> 
````


## 2) Пропагейт ошибка

````sh
INFO [11-01|17:07:03.888] Move to processing list                  TX hash=8323d8..7f25d2 TX nonce=1
INFO [11-01|17:07:03.888] Insert propagated block                  Height=2 Hash=0xe21fc8bcdfc6ce1850a0fb8005bce5a3197d405fe175443f305d187bc7375d45 txs=1 parents=[0x016ea8ae4a472783dc11eafab3a8344ff590d7a3a43a51a81f7061a340bce5b5]
INFO [11-01|17:07:03.888] Insert propagated block                  height=2 hash=0xe21fc8bcdfc6ce1850a0fb8005bce5a3197d405fe175443f305d187bc7375d45
INFO [11-01|17:07:03.888] Announced block                          hash=0xe21fc8bcdfc6ce1850a0fb8005bce5a3197d405fe175443f305d187bc7375d45 recipients=0 duration="979.712µs"
INFO [11-01|17:07:06.234] Move to processing list                  TX hash=06babc..50777a TX nonce=2
INFO [11-01|17:07:06.235] Insert propagated block                  Height=3 Hash=0x35bcd448e3cccb5b69e8e89c9bc9161aee5018e1e7b8023c097e53e2f21d4c24 txs=1 parents=[0xe21fc8bcdfc6ce1850a0fb8005bce5a3197d405fe175443f305d187bc7375d45]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x983ac6]

goroutine 136995 [running]:
github.com/waterfall-foundation/gwat/core/types.(*Block).ParentHashes(...)
        /home/mezin/go/src/gwat/core/types/block.go:322
github.com/waterfall-foundation/gwat/core.(*BlockChain).insertPropagatedBlocks(0xc0000f6000, {0xc000c8ae58, 0x1, 0x1})
        /home/mezin/go/src/gwat/core/blockchain.go:2120 +0xce6
github.com/waterfall-foundation/gwat/core.(*BlockChain).InsertPropagatedBlocks(0xc0000f6000, {0xc000c8ae58, 0x1, 0x1})
        /home/mezin/go/src/gwat/core/blockchain.go:1585 +0x1b3
github.com/waterfall-foundation/gwat/eth.newHandler.func3({0xc000b72200, 0x40}, {0xc000c8ae58, 0x137ad60, 0x1})
        /home/mezin/go/src/gwat/eth/handler.go:216 +0xa7
github.com/waterfall-foundation/gwat/eth/fetcher.(*BlockFetcher).importBlocks.func1()
        /home/mezin/go/src/gwat/eth/fetcher/block_fetcher.go:833 +0x4b2
created by github.com/waterfall-foundation/gwat/eth/fetcher.(*BlockFetcher).importBlocks
        /home/mezin/go/src/gwat/eth/fetcher/block_fetcher.go:809 +0x28f

Process finished with the exit code 2

````

![Debug](https://i.imgur.com/PkzyqAr.png)


##### Ну да, пытаемся вытянуть не финализированный блок по номеру

## 3) после ошибки сброшенный даг, и финализированная часть не соответствует последнему состоянию, но сами блоки по хешу есть

````sh
> admin.nodeInfo
{
  enode: "enode://543aecc87723f27492b61932a9b36eae85f1d857025172ca35bd110cd0f3d2cb121b5c7151d16dbe34be409d00f53c5299431beef51a4009ba7a75b41a915240@46.37.206.18:30323",
  enr: "enr:-KO4QHIz1oyfB9mHHd2ywBxxe6ImRPpCM4NrZLGEgPpul_Wtb94rbLgQM_XxjyiOdVPhpFM-TN-57euvlx3sMNccfquGAYQ0fh5Pg2V0aMfGhDswPraAgmlkgnY0gmlwhC4lzhKJc2VjcDI1NmsxoQJUOuzIdyPydJK2GTKps26uhfHYVwJRcso1vREM0PPSy4RzbmFwwIN0Y3CCdnODdWRwgnZz",
  id: "2978d5d2bb2f7d0f3d2154ccd88d8e3b2d2115eef00a57acd25acc7de778e764",
  ip: "46.37.206.18",
  listenAddr: "[::]:30323",
  name: "Geth/v0.4.6-unstable/linux-amd64/go1.17.10",
  ports: {
    discovery: 30323,
    listener: 30323
  },
  protocols: {
    snap: {},
    wfdag: {
      config: {
        chainId: 333777333,
        eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      dag: ["0xc24b3c3f0e103e14fa627ea3f634be06106d72656ee039ed349788f762f4fcd5", "0x6b60e42de541959222c0c920adef697dcab2268734898cfe3f6aea7519747734", "0x591e471f2d5acae005be19c0b6c3597ba37d803c9618341c8a7d49e6b5121bf6", "0xf0014cb6832662e78b1423244b6588610b122eaef26c44e8fb669ec3de4310a7", "0x46f0655ae112cb97487b799996bf10960ae324848f67d5aab43e6cf952b91fcc", "0x8fc34a60afd0dca124c68f3d2539b8434768b9a0b77d43f97c85f0410a401816", "0xcd0aaeef11a051eae92730e8b83c4ca11dbe8d61709061c522de5f39fa8b0313", "0xdbb9c7f76ee1bd77bc6bd2415807a620f7b1f9920bb2fcc21d7eefc998881669"],
      genesis: "0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545",
      lastFinNr: 4,
      network: 333777333,
      versions: [1]
    }
  }
}
> INFO [11-01|20:56:07.331] Looking for peers                        peercount=2 tried=105 static=0
INFO [11-01|20:56:17.342] Looking for peers                        peercount=1 tried=80  static=0
INFO [11-01|20:56:27.357] Looking for peers                        peercount=2 tried=80  static=0
INFO [11-01|20:56:27.953] Move to processing list                  TX hash=642400..cee78b TX nonce=8
INFO [11-01|20:56:27.953] Insert propagated block                  Height=13 Hash=0x52e0a58ca934fe19235f1687dff3ed9f5cfe3a0ea14f7a79ae75260c108bfbc9 txs=1 parents="[0x46f0655ae112cb97487b799996bf10960ae324848f67d5aab43e6cf952b91fcc 0x8fc34a60afd0dca124c68f3d2539b8434768b9a0b77d43f97c85f0410a401816 0xc24b3c3f0e103e14fa627ea3f634be06106d72656ee039ed349788f762f4fcd5]"
INFO [11-01|20:56:27.953] Insert propagated block                  height=13 hash=0x52e0a58ca934fe19235f1687dff3ed9f5cfe3a0ea14f7a79ae75260c108bfbc9
INFO [11-01|20:56:27.953] Announced block                          hash=0x52e0a58ca934fe19235f1687dff3ed9f5cfe3a0ea14f7a79ae75260c108bfbc9 recipients=0 duration=1.408ms
INFO [11-01|20:56:29.143] Move to processing list                  TX hash=152064..0dee53 TX nonce=9
INFO [11-01|20:56:29.143] Insert propagated block                  Height=14 Hash=0x65d50fb2871e7eace66fc8481c2d10ef98706b5c96923e5add43f7289fc9968c txs=1 parents=[0x52e0a58ca934fe19235f1687dff3ed9f5cfe3a0ea14f7a79ae75260c108bfbc9]
INFO [11-01|20:56:29.143] Insert propagated block                  height=14 hash=0x65d50fb2871e7eace66fc8481c2d10ef98706b5c96923e5add43f7289fc9968c
INFO [11-01|20:56:29.144] Announced block                          hash=0x65d50fb2871e7eace66fc8481c2d10ef98706b5c96923e5add43f7289fc9968c recipients=0 duration=1.037ms
INFO [11-01|20:56:30.232] Move to processing list                  TX hash=178605..f6ac48 TX nonce=10
INFO [11-01|20:56:30.232] Insert propagated block                  Height=15 Hash=0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1 txs=1 parents=[0x65d50fb2871e7eace66fc8481c2d10ef98706b5c96923e5add43f7289fc9968c]
INFO [11-01|20:56:30.232] Insert propagated block                  height=15 hash=0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1
INFO [11-01|20:56:30.232] Announced block                          hash=0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1 recipients=0 duration=1.284ms
INFO [11-01|20:56:31.818] Move to processing list                  TX hash=7e474e..635324 TX nonce=11
INFO [11-01|20:56:31.818] Insert propagated block                  Height=16 Hash=0x906afd0273f6a52503eefe8cff2a099ed0adf6f96be7b477817eb3c21af932b0 txs=1 parents=[0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x983ac6]

goroutine 1882 [running]:
github.com/waterfall-foundation/gwat/core/types.(*Block).ParentHashes(...)
        /home/mezin/go/src/gwat/core/types/block.go:322
github.com/waterfall-foundation/gwat/core.(*BlockChain).insertPropagatedBlocks(0xc000334000, {0xc0006d7ef8, 0x1, 0x1})
        /home/mezin/go/src/gwat/core/blockchain.go:2120 +0xce6
github.com/waterfall-foundation/gwat/core.(*BlockChain).InsertPropagatedBlocks(0xc000334000, {0xc0006d7ef8, 0x1, 0x1})
        /home/mezin/go/src/gwat/core/blockchain.go:1585 +0x1b3
github.com/waterfall-foundation/gwat/eth.newHandler.func3({0xc0014824c0, 0x40}, {0xc0006d7ef8, 0xc000000078, 0x1})
        /home/mezin/go/src/gwat/eth/handler.go:216 +0xa7
github.com/waterfall-foundation/gwat/eth/fetcher.(*BlockFetcher).importBlocks.func1()
        /home/mezin/go/src/gwat/eth/fetcher/block_fetcher.go:833 +0x4b2
created by github.com/waterfall-foundation/gwat/eth/fetcher.(*BlockFetcher).importBlocks
        /home/mezin/go/src/gwat/eth/fetcher/block_fetcher.go:809 +0x28f

````

##### После перезапуска ноды

````sh
> admin.nodeInfo
{
  enode: "enode://543aecc87723f27492b61932a9b36eae85f1d857025172ca35bd110cd0f3d2cb121b5c7151d16dbe34be409d00f53c5299431beef51a4009ba7a75b41a915240@46.37.206.18:30323",
  enr: "enr:-KO4QFPByTpnXuKfnfTaiWVnP7KE9xwd3DGO4mQ4j71iBaAPCTmt5Luo41VSQBxE1RAitcN3jCC08EzojayMlydtbWGGAYQ0fh5Rg2V0aMfGhDswPraAgmlkgnY0gmlwhC4lzhKJc2VjcDI1NmsxoQJUOuzIdyPydJK2GTKps26uhfHYVwJRcso1vREM0PPSy4RzbmFwwIN0Y3CCdnODdWRwgnZz",
  id: "2978d5d2bb2f7d0f3d2154ccd88d8e3b2d2115eef00a57acd25acc7de778e764",
  ip: "46.37.206.18",
  listenAddr: "[::]:30323",
  name: "Geth/v0.4.6-unstable/linux-amd64/go1.17.10",
  ports: {
    discovery: 30323,
    listener: 30323
  },
  protocols: {
    snap: {},
    wfdag: {
      config: {
        chainId: 333777333,
        eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      dag: ["0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320"],
      genesis: "0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545",
      lastFinNr: 1,
      network: 333777333,
      versions: [1]
    }
  }
}
> 
> eth.getBlock(1)
{
  hash: "0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320",
  height: 1,
  lfHash: "0x08da51485996e08e5cc505a47f3574773ae9c7cdb45665bf5b12c99f218b0245",
  lfNumber: 0,
  miner: "0xe43bb1b64fc7068d313d24d01d8ccca785b22c72",
  number: 1,
  parentHashes: ["0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545"],
  receiptsRoot: "0x75308898d571eafb5cd8cde8278bf5b3d13c5f6ec074926de3bb895b519264e1",
  size: 580,
  slot: 1,
  stateRoot: "0xd7f5b7e808d2107279b974b79d1af4ba39af9649958953dadcadaf2fa991cad4",
  timestamp: 1667328020,
  transactions: ["0xa5cac216f41e5072e7290201a1894ecc73878e5de2ae66ac70c9cec3fbbcfc85", "0x53e6fc8ec9217816eccbfb347699ea84c7c684c60b15007d78f6c77035ca5861"],
  transactionsRoot: "0x523d10a322e2110ed5dbc820f0fac4f229f7eb36b13cd8a39d342eadae45121d"
}
> eth.getBlock(2)
null
> eth.getBlock(3)
null
> eth.getBlock(4)
null
> eth.getBlock("0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1")
{
  hash: "0x5ff14e70b87e9a21c9b104fe043f301ecd6db9d9f1ca1ca78bb26c82b19feec1",
  height: 15,
  lfHash: "0xdb9160f3a08bc30c5cbf9ca4f4ae1d0936f39bd880ea5cd7618d0a638e13873a",
  lfNumber: 4,
  miner: "0xa7e558cc6efa1c41270ef4aa227b3dd6b4a3951e",
  number: null,
  parentHashes: ["0x65d50fb2871e7eace66fc8481c2d10ef98706b5c96923e5add43f7289fc9968c"],
  receiptsRoot: "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",
  size: 458,
  slot: 7,
  stateRoot: "0x4ab24edf88de87477fca1856608fe41db8494063a6cc9d7f92872124aff25710",
  timestamp: 1667328990,
  transactions: ["0x1786054c1ad639e0a052b4cdc6231b83b29b5403f7504e59eb4c0270f2f6ac48"],
  transactionsRoot: "0x7ac58aef919b2e1e079647674f2973cb37decb5667a85c50acb2710f05324cfe"
}

````

## 4) Перезапуск(после ошибки) -> подключение к ведущей ноде -> синнхронизация -> вылет

возможно связанно с несколкими блоками на слот (испльзовались мультикриейторы при создании блоков)


````sh
GOROOT=/usr/local/go #gosetup
GOPATH=/home/mezin/go #gosetup
/usr/local/go/bin/go build -o /tmp/GoLand/___1beacon_0 github.com/waterfall-foundation/gwat/cmd/geth #gosetup
/tmp/GoLand/___1beacon_0 --datadir=.data/beacon-0 --networkid=333777333 --verbosity=3 --unlock=6e9e76fa278190cfb2404e5923d3ccd7e8f6c51d --password=.data/beacon/password.txt --allow-insecure-unlock --syncmode=full --port=30323 --bootnodes=enode://87395dfcbb2a2310f394e3f731221f989541cce144dc9fb5aee809ecd203fa647f417841cb468d5493a56a260e64edbdede22514937bc4c860c1464b6ebbea14@46.37.206.18:30303 console
INFO [11-01|21:05:27.442] Maximum peer count                       ETH=50 LES=0 total=50
INFO [11-01|21:05:27.442] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [11-01|21:05:27.442] Set global gas cap                       cap=50,000,000
INFO [11-01|21:05:27.442] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [11-01|21:05:27.442] Allocated cache and file handles         database=/home/mezin/go/src/gwat/.data/beacon-0/geth/chaindata cache=512.00MiB handles=524,288
INFO [11-01|21:05:27.473] Opened ancient database                  database=/home/mezin/go/src/gwat/.data/beacon-0/geth/chaindata/ancient readonly=false
INFO [11-01|21:05:27.473] Initialised chain configuration          config="{ChainID: 333777333 Homestead: <nil> DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil> Byzantium: <nil> Constantinople: <nil> Petersburg: <nil> Istanbul: <nil>, Muir Glacier: <nil>, Berlin: <nil>, London: <nil>, Engine: unknown}"
INFO [11-01|21:05:27.474] Initialising Ethereum protocol           network=333,777,333 dbversion=8
INFO [11-01|21:05:27.475] Loaded tips                              hashes=[0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320]
INFO [11-01|21:05:27.475] Loaded most recent local header          hash=4ea8dc..44b320 finNr=1
INFO [11-01|21:05:27.475] Loaded most recent local full block      hash=4ea8dc..44b320 finNr=1
INFO [11-01|21:05:27.475] Loaded most recent local fast block      hash=4ea8dc..44b320 finNr=1
WARN [11-01|21:05:27.475] Loaded snapshot journal                  diskroot=d7f5b7..91cad4 diffs=missing
INFO [11-01|21:05:27.476] Loaded local transaction journal         transactions=0 dropped=0
INFO [11-01|21:05:27.476] Regenerated local transaction journal    transactions=0 accounts=0
INFO [11-01|21:05:27.476] Gasprice oracle is ignoring threshold set threshold=2
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:39:51+0200 age=25m36s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:41:17+0200 age=24m10s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:44:12+0200 age=21m15s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:47:17+0200 age=18m10s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:50:37+0200 age=14m50s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:55:57+0200 age=9m30s
WARN [11-01|21:05:27.476] Unclean shutdown detected                booted=2022-11-01T20:57:15+0200 age=8m12s
INFO [11-01|21:05:27.476] Starting peer-to-peer node               instance=Geth/v0.4.6-unstable/linux-amd64/go1.17.10
INFO [11-01|21:05:27.532] New local node record                    seq=1,667,327,991,378 id=2978d5d2bb2f7d0f ip=127.0.0.1 udp=30323 tcp=30323
INFO [11-01|21:05:27.532] Started P2P networking                   self=enode://543aecc87723f27492b61932a9b36eae85f1d857025172ca35bd110cd0f3d2cb121b5c7151d16dbe34be409d00f53c5299431beef51a4009ba7a75b41a915240@127.0.0.1:30323
INFO [11-01|21:05:27.535] IPC endpoint opened                      url=/home/mezin/go/src/gwat/.data/beacon-0/geth.ipc
INFO [11-01|21:05:27.547] Block synchronisation started 
INFO [11-01|21:05:27.547] Synchronising with the network           peer=9232b455ed6ce0fb04ef9cafc3e560ef5da0d72d90fb21cca6d63463053a4b6a eth=1 mode=full lastFinNr=7 dag=[]
INFO [11-01|21:05:27.548] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=1 fromnum=7 skip=63 reverse=true
INFO [11-01|21:05:27.550] Remote head identified, no pivot         peer=9232b455 number=7 hash=0x6b60e42de541959222c0c920adef697dcab2268734898cfe3f6aea7519747734
INFO [11-01|21:05:27.550] Looking for common ancestor              peer=9232b455 local=1 remote=7
INFO [11-01|21:05:27.550] Span searching for common ancestor       peer=9232b455 count=4 from=0 skip=1
INFO [11-01|21:05:27.551] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=4 fromnum=0 skip=1  reverse=false
INFO [11-01|21:05:27.553] Span searching for common ancestor       packet="&{peerID:9232b455ed6ce0fb04ef9cafc3e560ef5da0d72d90fb21cca6d63463053a4b6a headers:[0xc0000d7d40 0xc000436240 0xc000436480 0xc0004366c0]}"
INFO [11-01|21:05:27.553] Looking for common ancestor Span Search result mode=full remoteHeight=7 floor=-1 ancestor=0 err="no common ancestor found"
INFO [11-01|21:05:27.553] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=1 fromnum=3 skip=0  reverse=false
INFO [11-01|21:05:27.556] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=1 fromnum=1 skip=0  reverse=false
INFO [11-01|21:05:27.558] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=1 fromnum=2 skip=0  reverse=false
INFO [11-01|21:05:27.560] Looking for common ancestor Binary Search result mode=full remoteHeight=7 floor=-1 ancestor=1 err=nil
INFO [11-01|21:05:27.560] Synchronization of finalized chain: start origin=1 latest.Number=7 latest.Hash=0x6b60e42de541959222c0c920adef697dcab2268734898cfe3f6aea7519747734
INFO [11-01|21:05:27.561] Fetching full headers                    peer=9232b455 count=192 from=2
INFO [11-01|21:05:27.561] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=192 fromnum=2 skip=0  reverse=false
INFO [11-01|21:05:27.563] Scheduling new headers                   peer=9232b455 count=6   from=2
INFO [11-01|21:05:27.563] Fetching full headers                    peer=9232b455 count=192 from=8
INFO [11-01|21:05:27.563] Synchronising is ending                  peer=9232b455ed6ce0fb04ef9cafc3e560ef5da0d72d90fb21cca6d63463053a4b6a eth=1 mode=0    from=8
INFO [11-01|21:05:27.563] Fetching batch of headers                id=9232b455ed6ce0fb conn=dyndial count=192 fromnum=8 skip=0  reverse=false
INFO [11-01|21:05:27.563] Fetching batch of block bodies           id=9232b455ed6ce0fb conn=dyndial count=1
INFO [11-01|21:05:27.566] No more headers available                peer=9232b455
INFO [11-01|21:05:27.567] Filtering bodies                         peer=9232b455ed6ce0fb04ef9cafc3e560ef5da0d72d90fb21cca6d63463053a4b6a txs=1
INFO [11-01|21:05:27.567] Downloader queue stats                   receiptTasks=0 blockTasks=0 itemSize=87.70B throttle=8192
INFO [11-01|21:05:27.567] Fetching batch of block bodies           id=9232b455ed6ce0fb conn=dyndial count=5
INFO [11-01|21:05:27.568] Block parent hashes                      hash=0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d ParentHashes=[0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545]
INFO [11-01|21:05:27.569] Block received root                      root=0xd0fb6d74f94650de3b5f0726d9fa427966c88c4e9bc59dfc91c98163c45f3111 hash=0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d
INFO [11-01|21:05:27.569] Block committed root                     root=0xd0fb6d74f94650de3b5f0726d9fa427966c88c4e9bc59dfc91c98163c45f3111 height=1 Nr=2 kind=syncInsertChain
INFO [11-01|21:05:27.569] Persisted trie from memory database      nodes=7 size=1.13KiB time="133.966µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [11-01|21:05:27.569] Imported new chain segment               blocks=1 txs=2 mgas=0.042 elapsed=1.387ms mgasps=30.276 number=0xc000708798 hash=73b7f9..17666d age=25m7s  dirty=0.00B
INFO [11-01|21:05:27.569] Synchronised part of finalized chain     mode=0    lastFinNr=2
INFO [11-01|21:05:27.571] Filtering bodies                         peer=9232b455ed6ce0fb04ef9cafc3e560ef5da0d72d90fb21cca6d63463053a4b6a txs=5
INFO [11-01|21:05:27.571] Block parent hashes                      hash=0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d ParentHashes=[0x351cd65f6e74ff61322d16c4a808bdce69c30410b3965fbbf188c46fa44da545]
INFO [11-01|21:05:27.571] Block received root                      root=0x615102007cfb85dcd29a972f38a3f739d24ab2496213bf822ab9ac23d9f76a41 hash=0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d
INFO [11-01|21:05:27.572] Block committed root                     root=0x615102007cfb85dcd29a972f38a3f739d24ab2496213bf822ab9ac23d9f76a41 height=1 Nr=3 kind=syncInsertChain
INFO [11-01|21:05:27.572] Persisted trie from memory database      nodes=5 size=890.00B time="53.443µs"  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [11-01|21:05:27.572] Recommit block transactions              Nr=2 height=1 slot=1 hash=0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d
INFO [11-01|21:05:27.572] Recommit block transactions              Nr=3 height=1 slot=1 hash=0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d
INFO [11-01|21:05:27.573] Block parent hashes                      hash=0x37eee647775e98140c5418981dec39fe063be155099dd3b2305884a94abb9b8b ParentHashes="[0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320 0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d 0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d]"
INFO [11-01|21:05:27.573] Block received root                      root=0x8ec136c5be7a50d6e9ba0cc3ae389b5a0297b8a0414a5de45dbc09c9499160e3 hash=0x37eee647775e98140c5418981dec39fe063be155099dd3b2305884a94abb9b8b
INFO [11-01|21:05:27.573] Block committed root                     root=0x478f0773bfa0578f1ffe3726d663c927cbb9ed6980ac87b3610ec642c0679d56 height=4 Nr=4 kind=syncInsertChain
INFO [11-01|21:05:27.573] Persisted trie from memory database      nodes=7 size=1.14KiB time="94.719µs"  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [11-01|21:05:27.573] Recommit block transactions              Nr=2 height=1 slot=1 hash=0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d
INFO [11-01|21:05:27.573] Recommit block transactions              Nr=3 height=1 slot=1 hash=0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d
INFO [11-01|21:05:27.574] Block parent hashes                      hash=0x591e471f2d5acae005be19c0b6c3597ba37d803c9618341c8a7d49e6b5121bf6 ParentHashes="[0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320 0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d 0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d]"
INFO [11-01|21:05:27.574] Block received root                      root=0xf7e47b1b3f3dc94a88b9c4efd69a981429421cd26090fb18710d7b23c3ab36ae hash=0x591e471f2d5acae005be19c0b6c3597ba37d803c9618341c8a7d49e6b5121bf6
INFO [11-01|21:05:27.574] Block committed root                     root=0x9bf30d6f86f009b0f4933d1c16af0f8429c4df83a1604b26dc3bc849d983b39d height=4 Nr=5 kind=syncInsertChain
INFO [11-01|21:05:27.574] Persisted trie from memory database      nodes=7 size=1.14KiB time="97.538µs"  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [11-01|21:05:27.574] Recommit block transactions              Nr=2 height=1 slot=1 hash=0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d
INFO [11-01|21:05:27.575] Recommit block transactions              Nr=3 height=1 slot=1 hash=0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d
INFO [11-01|21:05:27.575] Block parent hashes                      hash=0xf0014cb6832662e78b1423244b6588610b122eaef26c44e8fb669ec3de4310a7 ParentHashes="[0x4ea8dce27471e17f013333903fdd371613454185ad246abfbfee72154e44b320 0x73b7f989f0d78d6f2d645913de8e1be933ca920fd9e8ecef5dc45ce18e17666d 0x8c4ab69635b7b58458d3f362205e9f76783ca9c1229cb8004a7c070d98f8157d]"
INFO [11-01|21:05:27.575] Block received root                      root=0xe52e8d219cf50ace5475d76f75881501c206494530332cf7b43aa5ffd1bacd72 hash=0xf0014cb6832662e78b1423244b6588610b122eaef26c44e8fb669ec3de4310a7
INFO [11-01|21:05:27.575] Block committed root                     root=0xfc8cf5de7cb3ad9c3d2fd0ea20a9e86cd741788321600f483b329dd8d7dd9f36 height=4 Nr=6 kind=syncInsertChain
INFO [11-01|21:05:27.575] Persisted trie from memory database      nodes=7 size=1.14KiB time="96.578µs"  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
WARN [11-01|21:05:27.576] Collect State Data By Finalized Block: skip block nr=7 height=7 slot=3 hash=0x6b60e42de541959222c0c920adef697dcab2268734898cfe3f6aea7519747734 err="missing trie node 8ec136c5be7a50d6e9ba0cc3ae389b5a0297b8a0414a5de45dbc09c9499160e3 (path )"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7bddc5]

goroutine 161 [running]:
github.com/waterfall-foundation/gwat/core/state.(*StateDB).StartPrefetcher(0x0, {0x13e6075, 0xc0006ea460})
        /home/mezin/go/src/gwat/core/state/statedb.go:161 +0x25
github.com/waterfall-foundation/gwat/core.(*BlockChain).syncInsertChain(0xc0003d6000, {0xc0017a2e70, 0x1f50708, 0x5})
        /home/mezin/go/src/gwat/core/blockchain.go:1723 +0xc0f
github.com/waterfall-foundation/gwat/core.(*BlockChain).SyncInsertChain(0xc0003d6000, {0xc0017a2e70, 0x5, 0x5})
        /home/mezin/go/src/gwat/core/blockchain.go:1565 +0x6af
github.com/waterfall-foundation/gwat/eth/downloader.(*Downloader).importBlockResults(0xc00000c5a0, {0xc0017a2e40, 0x5, 0x0})
        /home/mezin/go/src/gwat/eth/downloader/downloader.go:2039 +0x46d
github.com/waterfall-foundation/gwat/eth/downloader.(*Downloader).processFullSyncContent(0xc00000c5a0)
        /home/mezin/go/src/gwat/eth/downloader/downloader.go:2013 +0x85
github.com/waterfall-foundation/gwat/eth/downloader.(*Downloader).spawnSync.func1()
        /home/mezin/go/src/gwat/eth/downloader/downloader.go:875 +0x70
created by github.com/waterfall-foundation/gwat/eth/downloader.(*Downloader).spawnSync
        /home/mezin/go/src/gwat/eth/downloader/downloader.go:873 +0x65

Process finished with the exit code 2

````



## 5) Попытка воспроизвести финализацию на ведомой ноде напоролась на невозможность создать блок на (из-за стейта при кре) 

#### но наверное стоит обратить внимание еще на то, что у парентов создаваемого блока уже могли быть финализированные ансесторы после генезиса.
#### (???) ну и скорее всего нода с отстающей финализацией вообще не должна создавать блок, и (???) наверное надо проваерять лф-номер у парентов 

> PS проверил парентов - все ссылаются на генезис, но суть вопроса это не меняет 


````sh
> qaz.do()
################  slot: 2
INFO [11-01|21:14:22.434] Setting new local account                address=0x6E9e76Fa278190CfB2404e5923d3CcD7e8f6C51D
INFO [11-01|21:14:22.435] Submitted transaction                    hash=0xe1898cd39fa6ca789b57007dfad113733fc2e7528ea062414dea6465f6fb4ced from=0x6E9e76Fa278190CfB2404e5923d3CcD7e8f6C51D nonce=0 recipient=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE value=10,000,000,000,000,000
+++ send txs +++ 0
+++ send txs +++ 1
INFO [11-01|21:14:22.436] Handle Consensus: start                  data="&{Slot:3 Creators:[0x6E9e76Fa278190CfB2404e5923d3CcD7e8f6C51D] Finalizing:[]}"
INFO [11-01|21:14:22.436] Handle Consensus: get finalizing candidates err=nil candidates="[0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732 0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674]" elapsed="325.062µs"
INFO [11-01|21:14:22.436] Handle Consensus: create condition       condition=true IsRunning=true errs=map[] dagSlots=2
INFO [11-01|21:14:22.436] Handle Consensus: response               result="&{Error:<nil> Info:0xc001fac188 Candidates:[0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732 0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674]}"
INFO [11-01|21:14:22.436] Creator assigned                         creator=0x6E9e76Fa278190CfB2404e5923d3CcD7e8f6C51D
RESP:: {
  "error": null,
  "info": {
    "elapsed": "735.606µs"
  },
  "candidates": [
    "0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732",
    "0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674"
  ]
}
undefined
> INFO [11-01|21:14:22.437] Creator data                             tips="{\"0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674\":{\"Hash\":\"0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674\",\"Height\":4,\"Slot\":2,\"LastFinalizedHash\":\"0x08da51485996e08e5cc505a47f3574773ae9c7cdb45665bf5b12c99f218b0245\",\"LastFinalizedHeight\":0,\"DagChainHashes\":[\"0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732\",\"0x85511c2ac6da32e9793ea0fb4ac19b4ade8c984105d510cb19373bdf70657909\",\"0xa3a77a2c262bedf94817a065e2aa19b4fa2e37826b8b109a210927c3d6da3c5c\"]},\"0xc3dd744945fa9f4f0f7df7e0f2d562612a1a769c118aeaf98a045ed2dcf907d6\":{\"Hash\":\"0xc3dd744945fa9f4f0f7df7e0f2d562612a1a769c118aeaf98a045ed2dcf907d6\",\"Height\":4,\"Slot\":2,\"LastFinalizedHash\":\"0x08da51485996e08e5cc505a47f3574773ae9c7cdb45665bf5b12c99f218b0245\",\"LastFinalizedHeight\":0,\"DagChainHashes\":[\"0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732\",\"0x85511c2ac6da32e9793ea0fb4ac19b4ade8c984105d510cb19373bdf70657909\",\"0xa3a77a2c262bedf94817a065e2aa19b4fa2e37826b8b109a210927c3d6da3c5c\"]},\"0xc74945df6d494b390c69a0007228d8bd11c2479c9b1c7400cb110cfea42f4a68\":{\"Hash\":\"0xc74945df6d494b390c69a0007228d8bd11c2479c9b1c7400cb110cfea42f4a68\",\"Height\":4,\"Slot\":2,\"LastFinalizedHash\":\"0x08da51485996e08e5cc505a47f3574773ae9c7cdb45665bf5b12c99f218b0245\",\"LastFinalizedHeight\":0,\"DagChainHashes\":[\"0x011d5a24db8da86125c005a568ac78b2af2bbfa8303fe5fca4adfafa296c6732\",\"0x85511c2ac6da32e9793ea0fb4ac19b4ade8c984105d510cb19373bdf70657909\",\"0xa3a77a2c262bedf94817a065e2aa19b4fa2e37826b8b109a210927c3d6da3c5c\"]}}"
INFO [11-01|21:14:22.437] Creator calculate block height           newHeight=7 ancestors=6 lastFinNr=0
ERROR[11-01|21:14:22.438] Error while get state by parents         slot=2 nr=0 height=4 hash=0x7ae2ef9f03983564a42f8ae96ce7d5bc8509cf0e91aff827835d7f7bd53e2674
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x99fffe]

goroutine 84 [running]:
github.com/waterfall-foundation/gwat/core/state.(*StateDB).StartPrefetcher(0x0, {0x1a668f3, 0x5})
        /home/mezin/go/src/gwat/core/state/statedb.go:161 +0x3e
github.com/waterfall-foundation/gwat/dag/creator.(*Creator).makeCurrent(0xc0000e2600, 0xc0028de480)
        /home/mezin/go/src/gwat/dag/creator/creator.go:560 +0x197
github.com/waterfall-foundation/gwat/dag/creator.(*Creator).commitNewWork(0xc0000e2600, 0xc0028b1380, 0x6361700e)
        /home/mezin/go/src/gwat/dag/creator/creator.go:862 +0x1545
github.com/waterfall-foundation/gwat/dag/creator.(*Creator).mainLoop(0xc0000e2600)
        /home/mezin/go/src/gwat/dag/creator/creator.go:377 +0x539
created by github.com/waterfall-foundation/gwat/dag/creator.New
        /home/mezin/go/src/gwat/dag/creator/creator.go:178 +0x685

Debugger finished with the exit code 0

````

![](https://i.imgur.com/H9hTElB.png)

