github.com/johnathanhowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/modules/transactionpool/update_test.go (about) 1 package transactionpool 2 3 import ( 4 "testing" 5 6 "github.com/NebulousLabs/Sia/modules" 7 "github.com/NebulousLabs/Sia/types" 8 ) 9 10 // TestArbDataOnly tries submitting a transaction with only arbitrary data to 11 // the transaction pool. Then a block is mined, putting the transaction on the 12 // blockchain. The arb data transaction should no longer be in the transaction 13 // pool. 14 func TestArbDataOnly(t *testing.T) { 15 if testing.Short() { 16 t.SkipNow() 17 } 18 tpt, err := createTpoolTester("TestArbDataOnly") 19 if err != nil { 20 t.Fatal(err) 21 } 22 txn := types.Transaction{ 23 ArbitraryData: [][]byte{ 24 append(modules.PrefixNonSia[:], []byte("arb-data")...), 25 }, 26 } 27 err = tpt.tpool.AcceptTransactionSet([]types.Transaction{txn}) 28 if err != nil { 29 t.Fatal(err) 30 } 31 if len(tpt.tpool.TransactionList()) != 1 { 32 t.Error("expecting to see a transaction in the transaction pool") 33 } 34 _, err = tpt.miner.AddBlock() 35 if err != nil { 36 t.Fatal(err) 37 } 38 if len(tpt.tpool.TransactionList()) != 0 { 39 t.Error("transaction was not cleared from the transaction pool") 40 } 41 }