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