Example #1
0
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
}
Example #2
0
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]
	}
}
Example #3
0
func (b *Block) SetNonce(non uint32) {
	answer := mymath.Uint322HexRev(non)
	copy(b.Nonce[:], answer)
}
Example #4
0
func (vm *VersionMessage) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	for i := 0; i < 4; i++ {
		vm.Version[i] = answer[i]
	}
}
Example #5
0
func (vm *VersionMessage) SetStartHeight(block uint32) {
	answer := mymath.Uint322HexRev(block)
	for i := 0; i < 4; i++ {
		vm.StartHeight[i] = answer[i]
	}
}
Example #6
0
func (na *NetworkAddress) SetTimestampNow(setTime uint32) {
	answer := mymath.Uint322HexRev(uint32(time.Seconds()))
	for i := 0; i < 4; i++ {
		na.Time[i] = answer[i]
	}
}
Example #7
0
func (na *NetworkAddress) SetTimestamp(setTime uint32) {
	answer := mymath.Uint322HexRev(setTime)
	for i := 0; i < 4; i++ {
		na.Time[i] = answer[i]
	}
}
Example #8
0
func (bh *BlockHeader) SetBits(bi uint32) {
	answer := mymath.Uint322HexRev(bi)
	copy(bh.Bits[:], answer)
}
Example #9
0
func (b *Block) SetBits(bi uint32) {
	answer := mymath.Uint322HexRev(bi)
	copy(b.Bits[:], answer)
}
Example #10
0
func (op *OutPoint) SetIndex(ind uint32) {
	answer := mymath.Uint322HexRev(ind)
	copy(op.Index[:], answer)
}
Example #11
0
func (ti *TxIn) SetSequence(seq uint32) {
	answer := mymath.Uint322HexRev(seq)
	copy(ti.Sequence[:], answer)
}
Example #12
0
func (r *Reply) SetReply(rep uint32) {
	answer := mymath.Uint322HexRev(rep) //TODO: check if it is rev or not
	copy(r.Reply[:], answer[:])
}
Example #13
0
func (bh *BlockHeader) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(bh.Version[:], answer[:])
}
Example #14
0
func (bh *BlockHeader) SetNonce(non uint32) {
	answer := mymath.Uint322HexRev(non)
	copy(bh.Nonce[:], answer)
}
Example #15
0
func (b *Block) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(b.Version[:], answer)
}
Example #16
0
func (b *Block) SetTimestamp(time uint32) {
	answer := mymath.Uint322HexRev(time)
	copy(b.Timestamp[:], answer)
}
Example #17
0
func (t *Tx) SetVersion(ver uint32) {
	answer := mymath.Uint322HexRev(ver)
	copy(t.Version[:], answer)
}
Example #18
0
func (gb *GetBlocks) SetVersion(newVersion uint32) {
	verchars := mymath.Uint322HexRev(newVersion)

	copy(gb.Version[:], verchars)
}
Example #19
0
func (t *Tx) SetLockTime(time uint32) {
	answer := mymath.Uint322HexRev(time)
	copy(t.LockTime[:], answer)
}