@@ -23,7 +23,7 @@ func main() {
2323
2424 ctx := context .Background ()
2525 client := internal .NewClient ()
26-
26+
2727 ledger , err := internal .GetRandomLedger (ctx , client )
2828 assert .Sometimes (err == nil , "should be able to get a random ledger" , internal.Details {
2929 "error" : err ,
@@ -35,7 +35,7 @@ func main() {
3535 const count = 100
3636
3737 pool := pond .New (10 , 10e3 )
38-
38+
3939 presentTime , err := internal .GetPresentTime (ctx , client , ledger )
4040 if err != nil {
4141 return
@@ -58,12 +58,12 @@ func CreateTransaction(
5858 ledger string ,
5959 presentTime * time.Time ,
6060) {
61- offsetTime := presentTime .Add (time .Duration (- int64 (random .GetRandom ()% 10 )))
61+ offsetTime := presentTime .Add (time .Duration (- int64 (random .GetRandom () % 10 )))
6262 txTime := random .RandomChoice ([]* time.Time {
6363 nil ,
6464 & offsetTime ,
6565 })
66-
66+
6767 switch random .RandomChoice ([]uint8 {0 , 1 }) {
6868 case 0 :
6969 CreateRandomPostingsTransaction (ctx , client , ledger , txTime )
@@ -84,18 +84,18 @@ func CreateRandomPostingsTransaction(
8484 res , err := client .Ledger .V2 .CreateTransaction (ctx , operations.V2CreateTransactionRequest {
8585 Ledger : ledger ,
8686 V2PostTransaction : shared.V2PostTransaction {
87- Postings : postings ,
87+ Postings : postings ,
8888 Timestamp : timestamp ,
89- Metadata : metadata ,
89+ Metadata : metadata ,
9090 },
9191 })
9292 if internal .AssertSometimesErrNil (
9393 err ,
9494 "should be able to create a postings transaction" ,
9595 internal.Details {
96- "ledger" : ledger ,
96+ "ledger" : ledger ,
9797 "postings" : postings ,
98- "error" : err ,
98+ "error" : err ,
9999 },
100100 ) {
101101 return
@@ -110,7 +110,7 @@ func CreateRandomPostingsTransaction(
110110 if errors .As (err , & getTxError ) {
111111 assert .Always (getTxError .ErrorCode != shared .V2ErrorsEnumNotFound , "should always be able to read previous writes" , internal.Details {
112112 "ledger" : ledger ,
113- "txId" : res .V2CreateTransactionResponse .Data .ID ,
113+ "txId" : res .V2CreateTransactionResponse .Data .ID ,
114114 })
115115 }
116116
@@ -126,7 +126,7 @@ func CreateRandomPostingsTransaction(
126126
127127 for account , volumes := range res .V2CreateTransactionResponse .Data .PostCommitVolumes {
128128 internal .CheckVolumes (volumes , initialOverdrafts [account ], internal.Details {
129- "ledger" : ledger ,
129+ "ledger" : ledger ,
130130 "account" : account ,
131131 })
132132 }
@@ -155,9 +155,9 @@ func CreateRandomNumscriptTransaction(
155155 destination = $to
156156 }
157157 ` ,
158- Vars : map [string ]string {
159- "from" : internal .GetRandomAddress (),
160- "to" : internal .GetRandomAddress (),
158+ Vars : map [string ]string {
159+ "from" : internal .GetRandomAddress (),
160+ "to" : internal .GetRandomAddress (),
161161 "amount" : internal .RandomBigInt ().String (),
162162 },
163163 },
@@ -169,7 +169,7 @@ func CreateRandomNumscriptTransaction(
169169 "should be able to create a numscript transaction" ,
170170 internal.Details {
171171 "ledger" : ledger ,
172- "error" : err ,
172+ "error" : err ,
173173 },
174174 ) {
175175 return
@@ -184,21 +184,21 @@ func CreateRandomNumscriptTransaction(
184184 if errors .As (err , & getTxError ) {
185185 assert .Always (getTxError .ErrorCode != shared .V2ErrorsEnumNotFound , "should always be able to read previous writes" , internal.Details {
186186 "ledger" : ledger ,
187- "txId" : res .V2CreateTransactionResponse .Data .ID ,
187+ "txId" : res .V2CreateTransactionResponse .Data .ID ,
188188 })
189189 }
190190
191191 for account , volumes := range res .V2CreateTransactionResponse .Data .PostCommitVolumes {
192192 internal .CheckVolumes (volumes , nil , internal.Details {
193- "ledger" : ledger ,
193+ "ledger" : ledger ,
194194 "account" : account ,
195195 })
196196 }
197197}
198198
199199func RandomTransactionMetadata () map [string ]string {
200200 metadata := make (map [string ]string )
201- for range random .GetRandom ()% 3 {
201+ for range random .GetRandom () % 3 {
202202 key := fmt .Sprintf ("%v" , random .GetRandom ()% 999 )
203203 metadata [key ] = fmt .Sprintf ("%v" , random .GetRandom ()% 999 )
204204 }
0 commit comments