Skip to content

Instantly share code, notes, and snippets.

01:08:39 bash@sultana ~/dload/code/rust-bitcoin/miniscript$ cargo test
Compiling miniscript v0.7.0 (/home/apoelstra/dload/code/rust-bitcoin/miniscript)
error[E0275]: overflow evaluating the requirement `&bitcoin::util::psbt::Input: miniscript::satisfy::Satisfier<bitcoin::PublicKey>`
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because of the requirements on the impl of `miniscript::satisfy::Satisfier<bitcoin::PublicKey>` for `&&bitcoin::util::psbt::Input`
= note: required because of the requirements on the impl of `miniscript::satisfy::Satisfier<bitcoin::PublicKey>` for `&&&bitcoin::util::psbt::Input`
= note: required because of the requirements on the impl of `miniscript::satisfy::Satisfier<bitcoin::PublicKey>` for `&&&&bitcoin::util::psbt::Input`
= note: required because of the requirements on the impl of `miniscript::satisfy::Satisfier<bitcoin::PublicKey>` for `&&&&&bitcoin::util::psbt::Input`
= note: required because of the requirements
-- Imports --
import System.IO
import System.Process
import System.Posix.IO
-- XMonad
import XMonad
import XMonad.Core
import qualified XMonad.StackSet as W
use std::cmp::Ordering;
use std::ops::{Add, Sub, Shl, Shr, Div, Not};
#[derive(Copy, Clone, PartialEq, Eq)]
struct Uint256([u64; 4]);
impl Uint256 {
fn bits(&self) -> usize {
for i in 1..4 {
// Rust JSON-RPC Library
// Written in 2015 by
// Andrew Poelstra <apoelstra@wpsoftware.net>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/// The "receiver set" of the select interface. This structure is used to manage
/// a set of receivers which are being selected over. The `Select` will act as a
/// receiver of type `U`. `'sel` is the lifetime of the stack frame of callbacks
/// which are passed to `Select::add`.
pub struct Select<'sel, U>;
/// A handle which is used to receive directly from a `Receiver` owned by a `Select`
pub struct RecvHandle<T>(uint);
impl<T:Send> RecvHandle<T> {
@apoelstra
apoelstra / gist:69c7615377c2b43a6eed
Created July 9, 2014 00:49
Select interface (look ma, no macros!)
/// A Select is a merge of multiple Receivers; you wait on a Select
/// and it blocks until any one of the attached Receivers sees
/// something.
struct Select<T>;
/// Identifier for Receivers attached to a Select
type RecvId = uint;
impl<T:Default> Select<T> {
/// Creates a new `Select` which receives objects of type `T`
impl <T:Serializable> Serializable for RefCell<T> {
fn serialize(&self) -> Vec<u8> {
self.borrow().serialize()
}
fn serialize_iter<'a>(&'a self) -> SerializeIter<'a> {
self.borrow().serialize_iter()
}
fn deserialize<I: Iterator<u8>>(iter: I) -> IoResult<RefCell<T>> {
@apoelstra
apoelstra / gist:aec063249270f2bf9949
Created July 8, 2014 15:05
Borrow problem in Rust
/// Add a new UTXO to the set
pub fn add_utxo(&mut self, txo: TxOut, txid: Sha256dHash, vout: uint) -> bool {
let txid = txid.as_bitv();
// Construct node if needed
let node = match self.tree.lookup_mut(&txid) {
Some(node) => node,
None => {
self.tree.insert(&txid, UtxoNode { out: vec![] });
// Note: If this fails, it indicates a bug in our program and/or an OOM
// condition. But maybe we should do something better than task failure
@apoelstra
apoelstra / gist:ce17b6528567988c89c3
Created July 7, 2014 17:36
Tree rotation without Rc
use std::ptr::RawPtr;
type NodeRef<T> = Option<Box<Node<T>>>;
type NodeBackRef<T> = *mut Node<T>;
struct Node<T> {
left: NodeRef<T>,
right: NodeRef<T>,
parent: NodeBackRef<T>,