1
// Copyright © 2017-2020 Trust Wallet.
2
//
3
// This file is part of Trust. The full Trust copyright notice, including
4
// terms governing use, modification, and redistribution, is contained in the
5
// file LICENSE at the root of the source code distribution tree.
6

7
#include "TransactionInput.h"
8

9
#include "../BinaryCoding.h"
10

11
using namespace TW::Bitcoin;
12

13 1
void TransactionInput::encode(Data& data) const {
14 1
    auto& outpoint = reinterpret_cast<const TW::Bitcoin::OutPoint&>(previousOutput);
15 1
    outpoint.encode(data);
16 1
    script.encode(data);
17 1
    encode32LE(sequence, data);
18
}
19

20 1
void TransactionInput::encodeWitness(Data& data) const {
21 1
    encodeVarInt(scriptWitness.size(), data);
22 1
    for (auto& item : scriptWitness) {
23 1
        encodeVarInt(item.size(), data);
24 1
        std::copy(std::begin(item), std::end(item), std::back_inserter(data));
25
    }
26
}

Read our documentation on viewing source code .

Loading