コード例 #1
0
ファイル: inv.go プロジェクト: ThePiachu/GoBit
func (iv *InventoryVector) Compile() []byte {
	answer := make([]byte, 4+len(iv.Hash))

	iterator := 0
	copy(answer[iterator:], mymath.Uint322HexRev(iv.Vectortype)) //TODO: check endianess
	iterator += 4
	copy(answer[iterator:], iv.Hash[:])

	return answer
}
コード例 #2
0
ファイル: bitmessage.go プロジェクト: ThePiachu/GoBit
func (bm *BitMessage) calculateChecksumAndLength() {
	tmp := mymath.Uint322HexRev(uint32(len(bm.Payload)))

	for i := 0; i < 4; i++ {
		bm.Length[i] = tmp[i]
	}

	tmp = mymath.DoubleSHA(bm.Payload)

	for i := 0; i < 4; i++ {
		bm.Checksum[i] = tmp[i]
	}
}
コード例 #3
0
ファイル: block.go プロジェクト: ThePiachu/GoBit
func (b *Block) SetNonce(non uint32) {
	answer := mymath.Uint322HexRev(non)
	copy(b.Nonce[:], answer)
}
コード例 #4
0
ファイル: version.go プロジェクト: ThePiachu/GoBit
func (vm *VersionMessage) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	for i := 0; i < 4; i++ {
		vm.Version[i] = answer[i]
	}
}
コード例 #5
0
ファイル: version.go プロジェクト: ThePiachu/GoBit
func (vm *VersionMessage) SetStartHeight(block uint32) {
	answer := mymath.Uint322HexRev(block)
	for i := 0; i < 4; i++ {
		vm.StartHeight[i] = answer[i]
	}
}
コード例 #6
0
ファイル: networkaddress.go プロジェクト: ThePiachu/GoBit
func (na *NetworkAddress) SetTimestampNow(setTime uint32) {
	answer := mymath.Uint322HexRev(uint32(time.Seconds()))
	for i := 0; i < 4; i++ {
		na.Time[i] = answer[i]
	}
}
コード例 #7
0
ファイル: networkaddress.go プロジェクト: ThePiachu/GoBit
func (na *NetworkAddress) SetTimestamp(setTime uint32) {
	answer := mymath.Uint322HexRev(setTime)
	for i := 0; i < 4; i++ {
		na.Time[i] = answer[i]
	}
}
コード例 #8
0
ファイル: headers.go プロジェクト: ThePiachu/GoBit
func (bh *BlockHeader) SetBits(bi uint32) {
	answer := mymath.Uint322HexRev(bi)
	copy(bh.Bits[:], answer)
}
コード例 #9
0
ファイル: block.go プロジェクト: ThePiachu/GoBit
func (b *Block) SetBits(bi uint32) {
	answer := mymath.Uint322HexRev(bi)
	copy(b.Bits[:], answer)
}
コード例 #10
0
ファイル: tx.go プロジェクト: ThePiachu/GoBit
func (op *OutPoint) SetIndex(ind uint32) {
	answer := mymath.Uint322HexRev(ind)
	copy(op.Index[:], answer)
}
コード例 #11
0
ファイル: tx.go プロジェクト: ThePiachu/GoBit
func (ti *TxIn) SetSequence(seq uint32) {
	answer := mymath.Uint322HexRev(seq)
	copy(ti.Sequence[:], answer)
}
コード例 #12
0
ファイル: reply.go プロジェクト: ThePiachu/GoBit
func (r *Reply) SetReply(rep uint32) {
	answer := mymath.Uint322HexRev(rep) //TODO: check if it is rev or not
	copy(r.Reply[:], answer[:])
}
コード例 #13
0
ファイル: headers.go プロジェクト: ThePiachu/GoBit
func (bh *BlockHeader) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(bh.Version[:], answer[:])
}
コード例 #14
0
ファイル: headers.go プロジェクト: ThePiachu/GoBit
func (bh *BlockHeader) SetNonce(non uint32) {
	answer := mymath.Uint322HexRev(non)
	copy(bh.Nonce[:], answer)
}
コード例 #15
0
ファイル: block.go プロジェクト: ThePiachu/GoBit
func (b *Block) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(b.Version[:], answer)
}
コード例 #16
0
ファイル: block.go プロジェクト: ThePiachu/GoBit
func (b *Block) SetTimestamp(time uint32) {
	answer := mymath.Uint322HexRev(time)
	copy(b.Timestamp[:], answer)
}
コード例 #17
0
ファイル: tx.go プロジェクト: ThePiachu/GoBit
func (t *Tx) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(t.Version[:], answer)
}
コード例 #18
0
ファイル: gets.go プロジェクト: ThePiachu/GoBit
func (gb *GetBlocks) SetVersion(newVersion uint32) {
	verchars := mymath.Uint322HexRev(newVersion)

	copy(gb.Version[:], verchars)
}
コード例 #19
0
ファイル: tx.go プロジェクト: ThePiachu/GoBit
func (t *Tx) SetLockTime(time uint32) {
	answer := mymath.Uint322HexRev(time)
	copy(t.LockTime[:], answer)
}