当前位置: 首页>>代码示例>>Golang>>正文


Golang Transaction.GetMilliTimestamp方法代码示例

本文整理汇总了Golang中github.com/FactomProject/factoid.Transaction.GetMilliTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Golang Transaction.GetMilliTimestamp方法的具体用法?Golang Transaction.GetMilliTimestamp怎么用?Golang Transaction.GetMilliTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/FactomProject/factoid.Transaction的用法示例。


在下文中一共展示了Transaction.GetMilliTimestamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Test_create_genesis_FactoidState


//.........这里部分代码省略.........
				} else {
					m = m[:k]
					fs.stats.errors["lost end of trans"] += 1
					fs.stats.full["lost end of trans"] = "lost end of trans"
				}
			}

			t := new(fct.Transaction)
			err = t.UnmarshalBinary(m)

			if good && tx.IsEqual(t) != nil {
				fmt.Println("Fail valid Unmarshal")
				test.Fail()
				return
			}
			if err == nil {
				if good && err != nil {
					fmt.Println("Added a transaction that should have failed to be added")
					fmt.Println(err)
					test.Fail()
					return
				}
				if !good {
					fmt.Println("Failed to add a transaction that should have added")
					test.Fail()
					return
				}
			}

			if good {
				err = fs.AddTransaction(j+1, t)
			}
			if !addtest && err == nil {
				ts := int64(t.GetMilliTimestamp())
				bts := int64(fs.GetCurrentBlock().GetCoinbaseTimestamp())
				fmt.Println("timestamp failure ", ts, bts, ts-bts, fct.TRANSACTION_POST_LIMIT)
				test.Fail()
				return
			}
			if !addtest && err == nil {
				fmt.Println("failed to catch error")
				test.Fail()
				return
			}

			if addtest && good && err != nil {
				fmt.Println(err)
				fmt.Println("Unmarshal Failed. trans is good",
					"\nand the error detected: ", err,
					"\nand k:", k, "and flip:", flip)
				test.Fail()
				return
			}

			if good && addtest {

				PrtTrans(t)
				fs.stats.transactions += 1

				title := fmt.Sprintf("Bad Transactions: %d  Total transaactions %d",
					fs.stats.badAddresses, fs.stats.transactions)
				cp.CP.AddUpdate("Bad Transaction", "status", title, "", 0)

				time.Sleep(time.Second / 100)
			} else {
				fs.stats.badAddresses += 1
开发者ID:FactomProject,项目名称:Testing,代码行数:67,代码来源:block_test.go

示例2: Test_create_genesis_FactoidState


//.........这里部分代码省略.........
				} else {
					m = m[:k]
					fs.stats.errors["lost end of trans"] += 1
					fs.stats.full["lost end of trans"] = "lost end of trans"
				}
			}

			t := new(fct.Transaction)
			err = t.UnmarshalBinary(m)

			if good && tx.IsEqual(t) != nil {
				fmt.Println("\n\n\n\n\n\nFail valid Unmarshal")
				test.Fail()
				return
			}
			if err == nil {
				if good && err != nil {
					fmt.Println("\n\n\n\n\n\n\nAdded a transaction that should have failed to be added")
					fmt.Println(err)
					test.Fail()
					return
				}
				if !good {
					fmt.Println("\n\n\n\n\n\n\nFailed to add a transaction that should have added")
					test.Fail()
					return
				}
			}

			if good {
				err = fs.AddTransaction(t)
			}
			if !addtest && err == nil {
				ts := int64(t.GetMilliTimestamp())
				bts := int64(fs.GetCurrentBlock().GetCoinbaseTimestamp())
				fmt.Println("\n\n\n\n\n\n\ntimestamp failure ", ts, bts, ts-bts, fct.TRANSACTION_POST_LIMIT)
				test.Fail()
				return
			}
			if !addtest && err == nil {
				fmt.Println("\n\n\n\n\n\n\nfailed to catch error")
				test.Fail()
				return
			}

			if addtest && good && err != nil {
				fmt.Println(err)
				fmt.Println("\n\n\n\n\n\n\n\n\n\nUnmarshal Failed. trans is good",
					"\nand the error detected: ", err,
					"\nand k:", k, "and flip:", flip)
				test.Fail()
				return
			}

			if good && addtest {
				fmt.Print("\033[32;0H")
				fmt.Println("Bad Transactions: ", fs.stats.badAddresses, "   Total transactions: ", cnt, "\r")
				fmt.Print("\033[42;0H")
				time.Sleep(9000)
				cnt += 1
			} else {
				fs.stats.badAddresses += 1
			}

		}
		//
开发者ID:msgilligan,项目名称:Testing,代码行数:67,代码来源:block_test.go


注:本文中的github.com/FactomProject/factoid.Transaction.GetMilliTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。