@@ -23,7 +23,9 @@ import (
23
23
"github.com/iotexproject/iotex-core/action/protocol/execution"
24
24
"github.com/iotexproject/iotex-core/action/protocol/rewarding"
25
25
"github.com/iotexproject/iotex-core/blockchain"
26
+ "github.com/iotexproject/iotex-core/blockchain/blockdao"
26
27
"github.com/iotexproject/iotex-core/config"
28
+ "github.com/iotexproject/iotex-core/db"
27
29
"github.com/iotexproject/iotex-core/state/factory"
28
30
"github.com/iotexproject/iotex-core/test/identityset"
29
31
"github.com/iotexproject/iotex-core/testutil"
@@ -167,11 +169,11 @@ func TestActPool_AddActs(t *testing.T) {
167
169
cfg .Genesis .InitBalanceMap [addr2 ] = "10"
168
170
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
169
171
require .NoError (err )
172
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
170
173
bc := blockchain .NewBlockchain (
171
174
cfg ,
172
- nil ,
175
+ dao ,
173
176
sf ,
174
- blockchain .InMemDaoOption (),
175
177
blockchain .RegistryOption (registry ),
176
178
)
177
179
require .NoError (bc .Start (context .Background ()))
@@ -200,7 +202,7 @@ func TestActPool_AddActs(t *testing.T) {
200
202
tsf8 , err := testutil .SignedTransfer (addr2 , priKey2 , uint64 (4 ), big .NewInt (5 ), []byte {}, uint64 (100000 ), big .NewInt (0 ))
201
203
require .NoError (err )
202
204
203
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
205
+ ep := execution .NewProtocol (dao .GetBlockHash )
204
206
require .NoError (ep .Register (registry ))
205
207
206
208
ctx := protocol .WithBlockchainCtx (context .Background (), protocol.BlockchainCtx {Registry : registry })
@@ -336,11 +338,11 @@ func TestActPool_PickActs(t *testing.T) {
336
338
cfgDefault .Genesis .InitBalanceMap [addr2 ] = "10"
337
339
sf , err := factory .NewFactory (cfgDefault , factory .InMemTrieOption ())
338
340
require .NoError (err )
341
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfgDefault .Chain .CompressBlock , cfgDefault .DB )
339
342
bc := blockchain .NewBlockchain (
340
343
cfgDefault ,
341
- nil ,
344
+ dao ,
342
345
sf ,
343
- blockchain .InMemDaoOption (),
344
346
blockchain .RegistryOption (registry ),
345
347
)
346
348
require .NoError (bc .Start (context .Background ()))
@@ -372,7 +374,7 @@ func TestActPool_PickActs(t *testing.T) {
372
374
tsf10 , err := testutil .SignedTransfer (addr2 , priKey2 , uint64 (5 ), big .NewInt (5 ), []byte {}, uint64 (100000 ), big .NewInt (0 ))
373
375
require .NoError (err )
374
376
375
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
377
+ ep := execution .NewProtocol (dao .GetBlockHash )
376
378
require .NoError (ep .Register (registry ))
377
379
378
380
ctx := protocol .WithBlockchainCtx (context .Background (), protocol.BlockchainCtx {Registry : registry })
@@ -415,16 +417,16 @@ func TestActPool_removeConfirmedActs(t *testing.T) {
415
417
cfg .Genesis .InitBalanceMap [addr1 ] = "100"
416
418
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
417
419
require .NoError (err )
420
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
418
421
bc := blockchain .NewBlockchain (
419
422
cfg ,
420
- nil ,
423
+ dao ,
421
424
sf ,
422
- blockchain .InMemDaoOption (),
423
425
blockchain .RegistryOption (registry ),
424
426
)
425
427
acc := account .NewProtocol (rewarding .DepositGas )
426
428
require .NoError (acc .Register (registry ))
427
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
429
+ ep := execution .NewProtocol (dao .GetBlockHash )
428
430
require .NoError (ep .Register (registry ))
429
431
require .NoError (bc .Start (context .Background ()))
430
432
// Create actpool
@@ -483,16 +485,16 @@ func TestActPool_Reset(t *testing.T) {
483
485
cfg .Genesis .InitBalanceMap [addr5 ] = "20"
484
486
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
485
487
require .NoError (err )
488
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
486
489
bc := blockchain .NewBlockchain (
487
490
cfg ,
488
- nil ,
491
+ dao ,
489
492
sf ,
490
- blockchain .InMemDaoOption (),
491
493
blockchain .RegistryOption (registry ),
492
494
)
493
495
acc := account .NewProtocol (rewarding .DepositGas )
494
496
require .NoError (acc .Register (registry ))
495
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
497
+ ep := execution .NewProtocol (dao .GetBlockHash )
496
498
require .NoError (ep .Register (registry ))
497
499
require .NoError (bc .Start (context .Background ()))
498
500
@@ -845,16 +847,16 @@ func TestActPool_removeInvalidActs(t *testing.T) {
845
847
registry := protocol .NewRegistry ()
846
848
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
847
849
require .NoError (err )
850
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
848
851
bc := blockchain .NewBlockchain (
849
852
cfg ,
850
- nil ,
853
+ dao ,
851
854
sf ,
852
- blockchain .InMemDaoOption (),
853
855
blockchain .RegistryOption (registry ),
854
856
)
855
857
acc := account .NewProtocol (rewarding .DepositGas )
856
858
require .NoError (acc .Register (registry ))
857
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
859
+ ep := execution .NewProtocol (dao .GetBlockHash )
858
860
require .NoError (ep .Register (registry ))
859
861
require .NoError (bc .Start (context .Background ()))
860
862
// Create actpool
@@ -898,16 +900,16 @@ func TestActPool_GetPendingNonce(t *testing.T) {
898
900
registry := protocol .NewRegistry ()
899
901
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
900
902
require .NoError (err )
903
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
901
904
bc := blockchain .NewBlockchain (
902
905
cfg ,
903
- nil ,
906
+ dao ,
904
907
sf ,
905
- blockchain .InMemDaoOption (),
906
908
blockchain .RegistryOption (registry ),
907
909
)
908
910
acc := account .NewProtocol (rewarding .DepositGas )
909
911
require .NoError (acc .Register (registry ))
910
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
912
+ ep := execution .NewProtocol (dao .GetBlockHash )
911
913
require .NoError (ep .Register (registry ))
912
914
require .NoError (bc .Start (context .Background ()))
913
915
// Create actpool
@@ -947,16 +949,16 @@ func TestActPool_GetUnconfirmedActs(t *testing.T) {
947
949
registry := protocol .NewRegistry ()
948
950
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
949
951
require .NoError (err )
952
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
950
953
bc := blockchain .NewBlockchain (
951
954
cfg ,
952
- nil ,
955
+ dao ,
953
956
sf ,
954
- blockchain .InMemDaoOption (),
955
957
blockchain .RegistryOption (registry ),
956
958
)
957
959
acc := account .NewProtocol (rewarding .DepositGas )
958
960
require .NoError (acc .Register (registry ))
959
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
961
+ ep := execution .NewProtocol (dao .GetBlockHash )
960
962
require .NoError (ep .Register (registry ))
961
963
require .NoError (bc .Start (context .Background ()))
962
964
// Create actpool
@@ -1053,16 +1055,16 @@ func TestActPool_GetSize(t *testing.T) {
1053
1055
re := protocol .NewRegistry ()
1054
1056
sf , err := factory .NewFactory (cfg , factory .InMemTrieOption ())
1055
1057
require .NoError (err )
1058
+ dao := blockdao .NewBlockDAO (db .NewMemKVStore (), nil , cfg .Chain .CompressBlock , cfg .DB )
1056
1059
bc := blockchain .NewBlockchain (
1057
1060
cfg ,
1058
- nil ,
1061
+ dao ,
1059
1062
sf ,
1060
- blockchain .InMemDaoOption (),
1061
1063
blockchain .RegistryOption (re ),
1062
1064
)
1063
1065
acc := account .NewProtocol (rewarding .DepositGas )
1064
1066
require .NoError (acc .Register (re ))
1065
- ep := execution .NewProtocol (bc . BlockDAO () .GetBlockHash )
1067
+ ep := execution .NewProtocol (dao .GetBlockHash )
1066
1068
require .NoError (ep .Register (re ))
1067
1069
require .NoError (bc .Start (context .Background ()))
1068
1070
// Create actpool
0 commit comments