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

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