func TestIngest(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("kahuna") defer tt.Finish() s := ingest(tt) tt.Require.NoError(s.Err) tt.Assert.Equal(59, s.Ingested) hq := &history.Q{Repo: tt.HorizonRepo()} // Ensure the root account was created var root history.Account err := hq.AccountByID(&root, 1) tt.Assert.NoError(err) tt.Assert.Equal(int64(1), root.ID) tt.Assert.Equal(keypair.Master(network.TestNetworkPassphrase).Address(), root.Address) // Test that re-importing fails s.Err = nil s.Run() tt.Require.Error(s.Err, "Reimport didn't fail as expected") // Test that re-importing fails with allowing clear succeeds s.Err = nil s.ClearExisting = true s.Run() tt.Require.NoError(s.Err, "Couldn't re-import, even with clear allowed") }
func TestForTransaction(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("kahuna") defer tt.Finish() q := &core.Q{Repo: tt.CoreRepo()} load := func(lg int32, tx int, op int) []xdr.AccountId { var txs []core.Transaction var fees []core.TransactionFee err := q.TransactionsByLedger(&txs, lg) tt.Require.NoError(err, "failed to load transaction data") err = q.TransactionFeesByLedger(&fees, lg) tt.Require.NoError(err, "failed to load transaction fee data") xtx := txs[tx].Envelope.Tx meta := txs[tx].ResultMeta fee := fees[tx].Changes ret, err := ForTransaction(&xtx, &meta, &fee) tt.Require.NoError(err, "ForOperation() errored") return ret } p := load(3, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", p[0].Address()) tt.Assert.Equal("GAXI33UCLQTCKM2NMRBS7XYBR535LLEVAHL5YBN4FTCB4HZHT7ZA5CVK", p[1].Address()) }
func TestTradeActions(t *testing.T) { tt := test.Start(t).Scenario("trades") defer tt.Finish() Convey("Trade Actions:", t, func() { app := NewTestApp() defer app.Close() rh := NewRequestHelper(app) Convey("GET /accounts/:account_id/trades", func() { w := rh.Get("/accounts/GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2/trades", test.RequestHelperNoop) So(w.Code, ShouldEqual, 200) So(w.Body, ShouldBePageOf, 1) }) Convey("GET /order_book/trades", func() { url := "/order_book/trades?" + "selling_asset_type=credit_alphanum4&" + "selling_asset_code=EUR&" + "selling_asset_issuer=GCQPYGH4K57XBDENKKX55KDTWOTK5WDWRQOH2LHEDX3EKVIQRLMESGBG&" + "buying_asset_type=credit_alphanum4&" + "buying_asset_code=USD&" + "buying_asset_issuer=GC23QF2HUE52AMXUFUH3AYJAXXGXXV2VHXYYR6EYXETPKDXZSAW67XO4" w := rh.Get(url, test.RequestHelperNoop) So(w.Code, ShouldEqual, 200) So(w.Body, ShouldBePageOf, 1) }) }) }
func TestScrub(t *testing.T) { tt := test.Start(t) defer tt.Finish() tt.Assert.Equal("scott", Scrub("scott")) tt.Assert.Equal("scött", Scrub("scött")) tt.Assert.Equal("�(", Scrub(string([]byte{0xC3, 0x28}))) }
func TestGetOrderBookSummary(t *testing.T) { tt := test.Start(t).Scenario("order_books") defer tt.Finish() q := &Q{tt.CoreRepo()} selling, err := AssetFromDB(xdr.AssetTypeAssetTypeCreditAlphanum4, "USD", "GC23QF2HUE52AMXUFUH3AYJAXXGXXV2VHXYYR6EYXETPKDXZSAW67XO4") tt.Require.NoError(err) buying, err := AssetFromDB(xdr.AssetTypeAssetTypeNative, "", "") tt.Require.NoError(err) var summary, inverted OrderBookSummary err = q.GetOrderBookSummary(&summary, selling, buying) tt.Require.NoError(err) tt.Require.Len(summary, 6) err = q.GetOrderBookSummary(&inverted, buying, selling) tt.Require.NoError(err) tt.Require.Len(inverted, 6) asks := summary.Asks() bids := summary.Bids() iasks := inverted.Asks() ibids := inverted.Bids() // Check that summary was loaded correct tt.Assert.Equal(int64(100000000), asks[0].Amount) tt.Assert.Equal(int32(15), asks[0].Pricen) tt.Assert.Equal(int32(1), asks[0].Priced) tt.Assert.Equal(int64(1000000000), asks[1].Amount) tt.Assert.Equal(int32(20), asks[1].Pricen) tt.Assert.Equal(int32(1), asks[1].Priced) tt.Assert.Equal(int64(10000000000), asks[2].Amount) tt.Assert.Equal(int32(50), asks[2].Pricen) tt.Assert.Equal(int32(1), asks[2].Priced) tt.Assert.Equal(int64(1000000000), bids[0].Amount) tt.Assert.Equal(int32(10), bids[0].Pricen) tt.Assert.Equal(int32(1), bids[0].Priced) tt.Assert.Equal(int64(9000000000), bids[1].Amount) tt.Assert.Equal(int32(9), bids[1].Pricen) tt.Assert.Equal(int32(1), bids[1].Priced) tt.Assert.Equal(int64(50000000000), bids[2].Amount) tt.Assert.Equal(int32(5), bids[2].Pricen) tt.Assert.Equal(int32(1), bids[2].Priced) // Check that the inversion was correct tt.Assert.Equal(asks[0].Pricef, ibids[0].InvertPricef()) tt.Assert.Equal(asks[1].Pricef, ibids[1].InvertPricef()) tt.Assert.Equal(asks[2].Pricef, ibids[2].InvertPricef()) tt.Assert.Equal(bids[0].Pricef, iasks[0].InvertPricef()) tt.Assert.Equal(bids[1].Pricef, iasks[1].InvertPricef()) tt.Assert.Equal(bids[2].Pricef, iasks[2].InvertPricef()) }
func TestFinder(t *testing.T) { tt := test.Start(t).Scenario("paths") defer tt.Finish() finder := &Finder{ Q: &core.Q{Repo: tt.CoreRepo()}, } native := makeAsset(xdr.AssetTypeAssetTypeNative, "", "") usd := makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "USD", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN") eur := makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "EUR", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN") query := paths.Query{ DestinationAddress: "GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V", DestinationAsset: eur, DestinationAmount: xdr.Int64(200000000), SourceAssets: []xdr.Asset{usd}, } p, err := finder.Find(query) if tt.Assert.NoError(err) { tt.Assert.Len(p, 3) } query.DestinationAmount = xdr.Int64(200000001) p, err = finder.Find(query) if tt.Assert.NoError(err) { tt.Assert.Len(p, 2) } query.DestinationAmount = xdr.Int64(500000001) p, err = finder.Find(query) if tt.Assert.NoError(err) { tt.Assert.Len(p, 0) } // regression: paths that involve native currencies can be found query = paths.Query{ DestinationAddress: "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", DestinationAsset: native, DestinationAmount: xdr.Int64(1), SourceAssets: []xdr.Asset{usd, native}, } p, err = finder.Find(query) if tt.Assert.NoError(err) { tt.Assert.Len(p, 2) } }
func TestLatestLedger(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.CoreRepo()} var seq int err := q.LatestLedger(&seq) if tt.Assert.NoError(err) { tt.Assert.Equal(3, seq) } }
func TestTransactionFeesByLedger(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.CoreRepo()} var fees []TransactionFee err := q.TransactionFeesByLedger(&fees, 2) if tt.Assert.NoError(err) { tt.Assert.Len(fees, 3) } }
func TestAccountQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonRepo()} // Test Accounts() acs := []Account{} err := q.Accounts().Select(&acs) if tt.Assert.NoError(err) { tt.Assert.Len(acs, 4) } }
func TestStringArray(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("base") defer tt.Finish() expr := StringArray([]string{"1", "2", "3"}).(sq.Sqlizer) sql, args, err := expr.ToSql() tt.Require.NoError(err) tt.Assert.Equal("?::character varying[]", sql) tt.Assert.Len(args, 1) tt.Assert.Equal("{1,2,3}", args[0]) }
func TestLedgerBundleLoad(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("base") defer tt.Finish() bundle := &LedgerBundle{Sequence: 2} err := bundle.Load(tt.CoreRepo()) if tt.Assert.NoError(err) { tt.Assert.Equal(uint32(2), bundle.Header.Sequence) tt.Assert.Len(bundle.Transactions, 3) tt.Assert.Len(bundle.TransactionFees, 3) } }
func TestCursor(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("kahuna") defer tt.Finish() // c := Cursor{ FirstLedger: 7, LastLedger: 10, DB: tt.CoreRepo(), } // Ledger 7 tt.Require.True(c.NextLedger()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.False(c.NextTx()) // Ledger 8 tt.Require.True(c.NextLedger()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.False(c.NextTx()) // Ledger 9 tt.Require.True(c.NextLedger()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.False(c.NextTx()) // Ledger 10 tt.Require.True(c.NextLedger()) tt.Require.True(c.NextTx()) tt.Require.True(c.NextOp()) tt.Require.True(c.NextOp()) tt.Require.False(c.NextOp()) tt.Require.False(c.NextTx()) tt.Require.False(c.NextLedger()) }
// REGRESSION: ensure that we can craft a transaction func TestFriendbot_makeTx(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() fb := &Bot{ Secret: "SAQWC7EPIYF3XGILYVJM4LVAVSLZKT27CTEI3AFBHU2VRCMQ3P3INPG5", Network: "Test SDF Network ; September 2015", sequence: 2, } _, err := fb.makeTx("GDJIN6W6PLTPKLLM57UW65ZH4BITUXUMYQHIMAZFYXF45PZVAWDBI77Z") tt.Require.NoError(err) }
func TestOperationQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonRepo()} // Test OperationByID var op Operation err := q.OperationByID(&op, 8589938689) if tt.Assert.NoError(err) { tt.Assert.Equal(int64(8589938689), op.ID) } // Test Operations() ops := []Operation{} err = q.Operations(). ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON"). Select(&ops) if tt.Assert.NoError(err) { tt.Assert.Len(ops, 2) } // ledger filter works ops = []Operation{} err = q.Operations().ForLedger(2).Select(&ops) if tt.Assert.NoError(err) { tt.Assert.Len(ops, 3) } // tx filter works hash := "2374e99349b9ef7dba9a5db3339b78fda8f34777b1af33ba468ad5c0df946d4d" ops = []Operation{} err = q.Operations().ForTransaction(hash).Select(&ops) if tt.Assert.NoError(err) { tt.Assert.Len(ops, 1) } // payment filter works tt.Scenario("pathed_payment") ops = []Operation{} err = q.Operations().OnlyPayments().Select(&ops) if tt.Assert.NoError(err) { tt.Assert.Len(ops, 10) } }
func TestTransactionQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonRepo()} // Test TransactionByHash var tx Transaction real := "2374e99349b9ef7dba9a5db3339b78fda8f34777b1af33ba468ad5c0df946d4d" err := q.TransactionByHash(&tx, real) tt.Assert.NoError(err) fake := "not_real" err = q.TransactionByHash(&tx, fake) tt.Assert.Equal(err, sql.ErrNoRows) }
func TestStreaming(t *testing.T) { tt := test.Start(t) defer tt.Finish() ctx, cancel := context.WithCancel(tt.Ctx) Convey("LedgerClosePump", t, func() { Convey("can cancel", func() { q := &history.Q{Repo: tt.HorizonRepo()} pump := NewLedgerClosePump(ctx, q) cancel() _, more := <-pump So(more, ShouldBeFalse) }) }) }
func TestResultProvider(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("base") defer tt.Finish() rp := &DB{ Core: &core.Q{Repo: tt.CoreRepo()}, History: &history.Q{Repo: tt.HorizonRepo()}, } // Regression: ensure a transaction that is not ingested still returns the // result hash := "2374e99349b9ef7dba9a5db3339b78fda8f34777b1af33ba468ad5c0df946d4d" ret := rp.ResultByHash(tt.Ctx, hash) tt.Require.NoError(ret.Err) tt.Assert.Equal(hash, ret.Hash) }
func TestHistoryAccount(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() db := tt.HorizonRepo() c := NewHistoryAccount(db) tt.Assert.Equal(0, c.cached.Len()) id, err := c.Get("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H") if tt.Assert.NoError(err) { tt.Assert.Equal(int64(1), id) tt.Assert.Equal(1, c.cached.Len()) } id, err = c.Get("NOT_REAL") tt.Assert.True(db.NoRows(err)) tt.Assert.Equal(int64(0), id) }
func TestOrderBook(t *testing.T) { tt := test.Start(t).Scenario("paths") defer tt.Finish() ob := orderBook{ Selling: makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "EUR", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"), Buying: makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "USD", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"), Q: &core.Q{Repo: tt.CoreRepo()}, } r, err := ob.Cost(ob.Buying, 10000000) if tt.Assert.NoError(err) { tt.Assert.Equal(xdr.Int64(10000000), r) } // this cost should consume the entire lowest priced order, whose price // is 1.0, thus the output should be the same r, err = ob.Cost(ob.Buying, 100000000) if tt.Assert.NoError(err) { tt.Assert.Equal(xdr.Int64(100000000), r) } // now we are taking from the next offer, where the price is 2.0 r, err = ob.Cost(ob.Buying, 100000001) if tt.Assert.NoError(err) { tt.Assert.Equal(xdr.Int64(100000002), r) } r, err = ob.Cost(ob.Buying, 500000000) if tt.Assert.NoError(err) { tt.Assert.Equal(xdr.Int64(900000000), r) } _, err = ob.Cost(ob.Buying, 500000001) tt.Assert.Error(err) }
func TestOrderBook_BadCost(t *testing.T) { tt := test.Start(t).Scenario("bad_cost") defer tt.Finish() ob := orderBook{ Selling: makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "EUR", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"), Buying: makeAsset( xdr.AssetTypeAssetTypeCreditAlphanum4, "USD", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"), Q: &core.Q{Repo: tt.CoreRepo()}, } r, err := ob.Cost(ob.Buying, 10000000) if tt.Assert.NoError(err) { tt.Assert.Equal(xdr.Int64(2000000000), r) } }
func TestLedgerQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonRepo()} // Test LedgerBySequence var l Ledger err := q.LedgerBySequence(&l, 3) tt.Assert.NoError(err) err = q.LedgerBySequence(&l, 100000) tt.Assert.Equal(err, sql.ErrNoRows) // Test Ledgers() ls := []Ledger{} err = q.Ledgers().Select(&ls) if tt.Assert.NoError(err) { tt.Assert.Len(ls, 3) } }
func TestTransactionsQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.CoreRepo()} // Test TransactionsByLedger var txs []Transaction err := q.TransactionsByLedger(&txs, 2) if tt.Assert.NoError(err) { tt.Assert.Len(txs, 3) } // Test TransactionByHash var tx Transaction err = q.TransactionByHash(&tx, "cebb875a00ff6e1383aef0fd251a76f22c1f9ab2a2dffcb077855736ade2659a") if tt.Assert.NoError(err) { tt.Assert.Equal(int32(3), tx.LedgerSequence) } }
func TestOffersByAddress(t *testing.T) { tt := test.Start(t).Scenario("trades") defer tt.Finish() q := &Q{tt.CoreRepo()} var offers []Offer load := func(addy, cursor, order string, limit uint64) bool { offers = []Offer{} pq, err := db2.NewPageQuery(cursor, order, limit) if !tt.Assert.NoError(err) { return false } err = q.OffersByAddress(&offers, addy, pq) if !tt.Assert.NoError(err) { return false } return true } // Works for native offers if load("GCXKG6RN4ONIEPCMNFB732A436Z5PNDSRLGWK7GBLCMQLIFO4S7EYWVU", "", "asc", 0) { tt.Assert.Len(offers, 1) tt.Assert.Equal(int64(4), offers[0].OfferID) } // Filters properly if load("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", "", "asc", 0) { tt.Assert.Len(offers, 0) } if load("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2", "", "asc", 0) { tt.Assert.Len(offers, 3) } // limits properly if load("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2", "", "asc", 2) { tt.Assert.Len(offers, 2) } // ordering works if load("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2", "", "desc", 0) { for i := range offers { // if there is no next element, break if i+1 == len(offers) { break } tt.Assert.True(offers[i].OfferID > offers[i+1].OfferID, "Results are not in order") } } // cursor works if load("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2", "1", "asc", 0) { tt.Assert.Len(offers, 2) tt.Assert.Equal(int64(2), offers[0].OfferID) } if load("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2", "3", "desc", 0) { tt.Assert.Len(offers, 2) tt.Assert.Equal(int64(2), offers[0].OfferID) } }
func TestForOperation(t *testing.T) { tt := test.Start(t).ScenarioWithoutHorizon("kahuna") defer tt.Finish() q := &core.Q{Repo: tt.CoreRepo()} load := func(lg int32, tx int, op int) []xdr.AccountId { var txs []core.Transaction err := q.TransactionsByLedger(&txs, lg) tt.Require.NoError(err, "failed to load transaction data") xtx := txs[tx].Envelope.Tx xop := xtx.Operations[op] ret, err := ForOperation(&xtx, &xop) tt.Require.NoError(err, "ForOperation() errored") return ret } // test create account p := load(3, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", p[0].Address()) tt.Assert.Equal("GAXI33UCLQTCKM2NMRBS7XYBR535LLEVAHL5YBN4FTCB4HZHT7ZA5CVK", p[1].Address()) // test payment p = load(8, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GA46VRKBCLI2X6DXLX7AIEVRFLH3UA7XBE3NGNP6O74HQ5LXHMGTV2JB", p[0].Address()) tt.Assert.Equal("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", p[1].Address()) // test path payment p = load(19, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GDRW375MAYR46ODGF2WGANQC2RRZL7O246DYHHCGWTV2RE7IHE2QUQLD", p[0].Address()) tt.Assert.Equal("GACAR2AEYEKITE2LKI5RMXF5MIVZ6Q7XILROGDT22O7JX4DSWFS7FDDP", p[1].Address()) // test manage offer p = load(18, 1, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GAXMF43TGZHW3QN3REOUA2U5PW5BTARXGGYJ3JIFHW3YT6QRKRL3CPPU", p[0].Address()) // test passive offer p = load(26, 0, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GB6GN3LJUW6JYR7EDOJ47VBH7D45M4JWHXGK6LHJRAEI5JBSN2DBQY7Q", p[0].Address()) // test set options p = load(28, 0, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GCIFFRQKHMH6JD7CK5OI4XVCYCMNRNF6PYA7JTCR3FPHPJZQTYYFB5ES", p[0].Address()) // test change trust p = load(22, 0, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GBOK7BOUSOWPHBANBYM6MIRYZJIDIPUYJPXHTHADF75UEVIVYWHHONQC", p[0].Address()) // test allow trust p = load(42, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GD4SMOE3VPSF7ZR3CTEQ3P5UNTBMEJDA2GLXTHR7MMARANKKJDZ7RPGF", p[0].Address()) tt.Assert.Equal("GCVW5LCRZFP7PENXTAGOVIQXADDNUXXZJCNKF4VQB2IK7W2LPJWF73UG", p[1].Address()) // test account merge p = load(44, 0, 0) tt.Require.Len(p, 2) tt.Assert.Equal("GCHPXGVDKPF5KT4CNAT7X77OXYZ7YVE4JHKFDUHCGCVWCL4K4PQ67KKZ", p[0].Address()) tt.Assert.Equal("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", p[1].Address()) // test inflation p = load(47, 0, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", p[0].Address()) // test manage data p = load(49, 0, 0) tt.Assert.Len(p, 1) tt.Assert.Equal("GAYSCMKQY6EYLXOPTT6JPPOXDMVNBWITPTSZIVWW4LWARVBOTH5RTLAD", p[0].Address()) }