示例#1
0
ptree prop_list(const history_row& row)
{
    ptree tree;

    tree.put("received.hash", btc256(row.output.hash));

    // missing received.height implies pending
    if (row.output_height != 0)
        tree.put("received.height", row.output_height);

    tree.put("received.index", row.output.index);

    // missing input implies unspent
    if (row.spend.hash != null_hash)
    {
        tree.put("spent.hash", btc256(row.spend.hash));

        // missing input.height implies spend unconfirmed
        if (row.spend_height != 0)
            tree.put("spent.height", row.spend_height);

        tree.put("spent.index", row.spend.index);
    }

    tree.put("value", row.value);
    return tree;
}
ptree prop_list(const chain::history& row)
{
    ptree tree;

    // missing output implies output cut off by server's history threshold
    if (row.output.hash != null_hash)
    {
        tree.put("received.hash", btc256(row.output.hash));

        // zeroized received.height implies output unconfirmed (in mempool)
        if (row.output_height != 0)
            tree.put("received.height", row.output_height);

        tree.put("received.index", row.output.index);
    }

    // missing input implies unspent
    if (row.spend.hash != null_hash)
    {
        tree.put("spent.hash", btc256(row.spend.hash));

        // zeroized input.height implies spend unconfirmed (in mempool)
        if (row.spend_height != 0)
            tree.put("spent.height", row.spend_height);

        tree.put("spent.index", row.spend.index);
    }

    tree.put("value", row.value);
    return tree;
}
示例#3
0
ptree prop_list(const header& header)
{
    const chain::header& block_header = header;

    ptree tree;
    tree.put("bits", block_header.bits);
    tree.put("hash", btc256(block_header.hash()));
    tree.put("merkle_tree_hash", btc256(block_header.merkle));
    tree.put("nonce", block_header.nonce);
    tree.put("previous_block_hash", btc256(block_header.previous_block_hash));
    tree.put("time_stamp", block_header.timestamp);
    tree.put("version", block_header.version);
    return tree;
}
ptree prop_list(const chain::point& point)
{
    ptree tree;
    tree.put("hash", btc256(point.hash));
    tree.put("index", point.index);
    return tree;
}
示例#5
0
ptree prop_list(const hash_digest& hash, size_t height, size_t index)
{
    ptree tree;
    tree.put("hash", btc256(hash));
    tree.put("height", height);
    tree.put("index", index);
    return tree;
}
示例#6
0
ptree prop_list(const client::stealth_row& row)
{
    ptree tree;
    tree.put("ephemeral_public_key", encode_base16(row.ephemeral_public_key));
    tree.put("public_key_hash", btc160(row.public_key_hash));
    tree.put("transaction_hash", btc256(row.transaction_hash));
    return tree;
}
ptree prop_list(const chain::stealth& row)
{
    ptree tree;
    tree.put("ephemeral_public_key", ec_public(row.ephemeral_public_key));
    tree.put("public_key_hash", btc160(row.public_key_hash));
    tree.put("transaction_hash", btc256(row.transaction_hash));
    return tree;
}
示例#8
0
ptree prop_list(const tx_type& tx, const hash_digest& block_hash,
    const payment_address& address)
{
    ptree tree;
    tree.add("block", btc256(block_hash));
    tree.add("address", address);
    tree.add_child("transaction", prop_list(tx));
    return tree;
}
示例#9
0
ptree prop_list(const transaction& transaction)
{
    const tx_type& tx = transaction;

    ptree tree;
    tree.put("hash", btc256(tx.hash()));
    tree.add_child("inputs", prop_tree_list("input", tx.inputs));
    tree.put("lock_time", tx.locktime);
    tree.add_child("outputs", prop_tree_list("output", tx.outputs));
    tree.put("version", tx.version);
    return tree;
}
示例#10
0
ptree prop_list(const tx_input_type& tx_input)
{
    ptree tree;
    const auto script_address = payment_address::extract(tx_input.script);
    if (script_address)
        tree.put("address", script_address);

    tree.put("previous_output.hash", btc256(tx_input.previous_output.hash));
    tree.put("previous_output.index", tx_input.previous_output.index);
    tree.put("script", script(tx_input.script).to_string());
    tree.put("sequence", tx_input.sequence);
    return tree;
}