@@ -23,11 +23,12 @@ import (
2323
2424 "github.com/algorand/go-algorand/config"
2525 "github.com/algorand/go-algorand/data/basics"
26+ "github.com/algorand/go-algorand/logging"
2627 "github.com/algorand/go-algorand/protocol"
2728 "github.com/algorand/go-algorand/test/partitiontest"
2829)
2930
30- func TestCreateSignedTx (t * testing.T ) {
31+ func TestCreateSignedTxBasic (t * testing.T ) {
3132 partitiontest .PartitionTest (t )
3233
3334 var networkState netState
@@ -36,6 +37,7 @@ func TestCreateSignedTx(t *testing.T) {
3637 networkState .nAccounts = 10
3738 networkState .roundTxnCnt = 4
3839 networkState .txnState = protocol .PaymentTx
40+ networkState .log = logging .TestingLog (t )
3941
4042 params := config .Consensus [protocol .ConsensusCurrentVersion ]
4143
@@ -50,7 +52,8 @@ func TestCreateSignedTx(t *testing.T) {
5052 require .Equal (t , protocol .PaymentTx , sntx .Txn .Type )
5153 }
5254
53- initialAccounts := networkState .accounts
55+ initialAccounts := make ([]basics.Address , len (networkState .accounts ))
56+ copy (initialAccounts , networkState .accounts )
5457
5558 // should be creating assets next
5659 sgtxns , _ = createSignedTx (src , basics .Round (1 ), params , & networkState )
@@ -59,7 +62,7 @@ func TestCreateSignedTx(t *testing.T) {
5962 require .Equal (t , protocol .ApplicationCallTx , networkState .txnState )
6063 require .Equal (t , uint64 (0 ), networkState .nAssets )
6164 // same accounts should be used
62- require .Equal (t , initialAccounts [ 0 ] , accounts [ 0 ] )
65+ require .Equal (t , initialAccounts , accounts )
6366 for _ , sntx := range sgtxns {
6467 require .Equal (t , protocol .AssetConfigTx , sntx .Txn .Type )
6568 }
@@ -69,7 +72,7 @@ func TestCreateSignedTx(t *testing.T) {
6972 require .Equal (t , 2 , len (sgtxns ))
7073 require .Equal (t , protocol .PaymentTx , networkState .txnState )
7174 require .Equal (t , uint64 (0 ), networkState .nApplications )
72- require .Equal (t , initialAccounts [ 0 ] , accounts [ 0 ] )
75+ require .Equal (t , initialAccounts , accounts )
7376 for _ , sntx := range sgtxns {
7477 require .Equal (t , protocol .ApplicationCallTx , sntx .Txn .Type )
7578 }
@@ -78,14 +81,22 @@ func TestCreateSignedTx(t *testing.T) {
7881 sgtxns , _ = createSignedTx (src , basics .Round (1 ), params , & networkState )
7982 require .Equal (t , 4 , len (sgtxns ))
8083 require .Equal (t , protocol .PaymentTx , networkState .txnState )
81- //new accounts should be created
82- accounts = networkState .accounts
83- require .NotEqual (t , initialAccounts [0 ], accounts [0 ])
84+ require .Equal (t , initialAccounts , accounts )
8485 for _ , sntx := range sgtxns {
8586 require .Equal (t , protocol .PaymentTx , sntx .Txn .Type )
8687 }
88+ }
8789
90+ func TestCreateSignedTxAssets (t * testing.T ) {
8891 // assets per account should not exceed limit
92+ partitiontest .PartitionTest (t )
93+
94+ params := config .Consensus [protocol .ConsensusCurrentVersion ]
95+ secretDst := keypair ()
96+ src := basics .Address (secretDst .SignatureVerifier )
97+
98+ var networkState netState
99+ networkState .log = logging .TestingLog (t )
89100 networkState .txnState = protocol .PaymentTx
90101 networkState .nAssets = 10
91102 networkState .nApplications = 10
0 commit comments