Example #1
0
func CreateTestAnchorEnry(dBlock *directoryBlock.DirectoryBlock) *entryBlock.Entry {
	answer := entryBlock.NewEntry()

	answer.ChainID = GetAnchorChainID()
	answer.Version = 0
	answer.ExtIDs = nil

	height := dBlock.GetHeader().GetDBHeight()

	ar := anchor.CreateAnchorRecordFromDBlock(dBlock)
	ar.Bitcoin = new(anchor.BitcoinStruct)
	ar.Bitcoin.Address = "1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1"
	ar.Bitcoin.TXID = fmt.Sprintf("%x", IntToByteSlice(int(height)))
	ar.Bitcoin.BlockHeight = int32(height)
	ar.Bitcoin.BlockHash = fmt.Sprintf("%x", IntToByteSlice(255-int(height)))
	ar.Bitcoin.Offset = int32(height % 10)

	hex, err := ar.MarshalAndSign(NewPrimitivesPrivateKey(0))
	if err != nil {
		panic(err)
	}

	answer.Content = primitives.ByteSlice{Bytes: hex}

	return answer
}