func BigToHash(in *big.Int) (*chainhash.Hash, error) {
	if in.Cmp(oneLsh256Minus1) > 0 {
		return nil, errors.New("big int out of bounds")
	}

	buf := [chainhash.HashSize]byte{}
	bigEndianBytes := in.Bytes()
	blen := len(bigEndianBytes)

	for i := 0; i < blen/2; i++ {
		bigEndianBytes[i], bigEndianBytes[blen-1-i] = bigEndianBytes[blen-1-i], bigEndianBytes[i]
	}

	blen = len(buf)

	for i := 0; i < blen; i++ {
		if i < len(bigEndianBytes) {
			buf[i] = bigEndianBytes[i]
		} else {
			buf[i] = 0
		}
	}

	h, err := chainhash.NewHash(buf[:])
	if err != nil {
		return nil, err
	}
	return h, nil
}
// BigToHash converts a big int to a chainhash
BigToHash converts a big int to a chainhash
// BigToHash converts a big int to a chainhash
func BigToHash(in *big.Int) (*chainhash.Hash, error) {
	if in.Cmp(oneLsh256Minus1) > 0 {
		return nil, errors.New("big int out of bounds")
	}
	buf := [chainhash.HashSize]byte{}
	bigEndianBytes := in.Bytes()
	blen := len(bigEndianBytes)
	for i := 0; i < blen/2; i++ {
		bigEndianBytes[i], bigEndianBytes[blen-1-i] = bigEndianBytes[blen-1-i], bigEndianBytes[i]
	}
	blen = len(buf)
	for i := 0; i < blen; i++ {
		if i < len(bigEndianBytes) {
			buf[i] = bigEndianBytes[i]
		} else {
			buf[i] = 0
		}
	}
	h, err := chainhash.NewHash(buf[:])
	if err != nil {
		return nil, err
	}
	return h, nil
}
func BigToHash ( in * big . Int ) ( * chainhash . Hash , error ) { if in . Cmp ( oneLsh256Minus1 ) > 0 { return nil , errors . New ( " " ) } buf := [ chainhash . HashSize ] byte { } bigEndianBytes := in . Bytes ( ) blen := len ( bigEndianBytes ) for i := 0 ; i < blen / 2 ; i ++ { bigEndianBytes [ i ] , bigEndianBytes [ blen - 1 - i ] = bigEndianBytes [ blen - 1 - i ] , bigEndianBytes [ i ] } blen = len ( buf ) for i := 0 ; i < blen ; i ++ { if i < len ( bigEndianBytes ) { buf [ i ] = bigEndianBytes [ i ] } else { buf [ i ] = 0 } } h , err := chainhash . NewHash ( buf [ : ] ) if err != nil { return nil , err } return h , nil }
BigToHash converts a big int to a chainhash
BigToHash converts a big int to a chainhash