Пример #1
0
bool STAccount::getValueH160 (uint160& v) const
{
    if (!isValueH160 ()) return false;

    memcpy (v.begin (), & (peekValue ().front ()), (160 / 8));
    return true;
}
Пример #2
0
// Handle the case where a directory item with no corresponding ledger entry
// is found. This shouldn't happen but if it does we clean it up.
void
OfferStream::erase (LedgerView& view)
{
    // NIKB NOTE This should be using LedgerView::dirDelete, which would
    //           correctly remove the directory if its the last entry.
    //           Unfortunately this is a protocol breaking change.

    auto p (view.entryCache (ltDIR_NODE, m_tip.dir()));

    if (p == nullptr)
    {
        if (m_journal.error) m_journal.error <<
                                                 "Missing directory " << m_tip.dir() <<
                                                 " for offer " << m_tip.index();
        return;
    }

    auto v (p->getFieldV256 (sfIndexes));
    auto& x (v.peekValue());
    auto it (std::find (x.begin(), x.end(), m_tip.index()));

    if (it == x.end())
    {
        if (m_journal.error) m_journal.error <<
                                                 "Missing offer " << m_tip.index() <<
                                                 " for directory " << m_tip.dir();
        return;
    }

    x.erase (it);
    p->setFieldV256 (sfIndexes, v);
    view.entryModify (p);

    if (m_journal.trace) m_journal.trace <<
                                             "Missing offer " << m_tip.index() <<
                                             " removed from directory " << m_tip.dir();
}
Пример #3
0
void STAccount::setValueH160(const uint160& v)
{
	peekValue().clear();
	peekValue().insert(peekValue().end(), v.begin(), v.end());
	assert(peekValue().size() == (160/8));
}
Пример #4
0
bool STAccount::isValueH160() const
{
	return peekValue().size() == (160 / 8);
}
Пример #5
0
STAccount::STAccount(SField::ref n, const uint160& v) : STVariableLength(n)
{
	peekValue().insert(peekValue().end(), v.begin(), v.end());
}
Пример #6
0
double popValue() {
        double result;
        result = peekValue();
        head -= sizeof(double);
        return result;
}