@@ -4,7 +4,6 @@ package tests
4
4
5
5
import (
6
6
"context"
7
- "fmt"
8
7
"testing"
9
8
10
9
"github.com/stretchr/testify/require"
@@ -14,11 +13,8 @@ import (
14
13
"github.com/iotaledger/iota-core/tools/docker-network/tests/dockertestframework"
15
14
)
16
15
17
- // Test_AccountTransitions follows the account state transition flow described in:
18
- // 1. Create account-1.
19
- // 2. Create account-2.
20
- // 3. account-1 requests faucet funds then allots 1000 mana to account-2.
21
- // 4. account-2 requests faucet funds then creates native tokens.
16
+ // Test_Payload_Nil tests that sending a nil payload does not result in a panic.
17
+ // This is a test to ensure issue #978 is fixed.
22
18
func Test_Payload_Nil_Test (t * testing.T ) {
23
19
d := dockertestframework .NewDockerTestFramework (t ,
24
20
dockertestframework .WithProtocolParametersOptions (dockertestframework .ShortSlotsAndEpochsProtocolParametersOptionsFunc ()... ),
@@ -42,20 +38,12 @@ func Test_Payload_Nil_Test(t *testing.T) {
42
38
t .Cleanup (cancel )
43
39
44
40
// create account-1
45
- accounts := d .CreateAccountsFromFaucet (ctx , 2 , "account-1" , "account-2" )
46
- account1 := accounts [0 ]
47
- account2 := accounts [1 ]
41
+ account := d .CreateAccountFromFaucet ("account-1" )
48
42
49
- // allot 1000 mana from account-1 to account-2
50
- fmt .Println ("Allotting mana from account-1 to account-2" )
51
- d .RequestFaucetFundsAndAllotManaTo (account1 .Wallet (), account2 .Account (), 1000 )
52
-
53
- // create native token
54
- fmt .Println ("Creating native token" )
55
- d .CreateNativeToken (account1 .Wallet (), 5_000_000 , 10_000_000_000 )
56
-
57
- blk := lo .PanicOnErr (account1 .Wallet ().CreateBasicBlock (ctx , "something" , mock .WithPayload (nil )))
43
+ // Issue a block with a nil payload.
44
+ blk := lo .PanicOnErr (account .Wallet ().CreateBasicBlock (ctx , "something" , mock .WithPayload (nil )))
58
45
d .SubmitBlock (ctx , blk .ProtocolBlock ())
59
46
47
+ // Wait for the epoch end to ensure the test does not exit early.
60
48
d .AwaitEpochFinalized ()
61
49
}
0 commit comments