• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-system / 23099638511

15 Mar 2026 12:26AM UTC coverage: 81.295% (-0.02%) from 81.31%
23099638511

push

github

web-flow
Merge pull request #1794 from evoskuil/master

Refactor json serializers into their own files.

120 of 165 new or added lines in 11 files covered. (72.73%)

2 existing lines in 1 file now uncovered.

11000 of 13531 relevant lines covered (81.29%)

3502537.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.47
/src/chain/json/transaction.cpp
1
/**
2
 * Copyright (c) 2011-2026 libbitcoin developers (see AUTHORS)
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/system/chain/json/json.hpp>
20

21
#include <bitcoin/system/chain/input.hpp>
22
#include <bitcoin/system/chain/output.hpp>
23
#include <bitcoin/system/chain/transaction.hpp>
24
#include <bitcoin/system/define.hpp>
25

26
namespace libbitcoin {
27
namespace system {
28
namespace chain {
29

30
DEFINE_JSON_TO_TAG(transaction)
2✔
31
{
32
    return
2✔
33
    {
34
        value.at("version").to_number<uint32_t>(),
2✔
35
        value_to<inputs>(value.at("inputs")),
2✔
36
        value_to<outputs>(value.at("outputs")),
4✔
37
        value.at("locktime").to_number<uint32_t>()
4✔
38
    };
6✔
39
}
40

41
DEFINE_JSON_FROM_TAG(transaction)
4✔
42
{
43
    value =
16✔
44
    {
45
        // hash is computed property
46
        { "hash", encode_hash(instance.hash(false)) },
4✔
47
        { "version", instance.version() },
48
        { "inputs", value_from(*instance.inputs_ptr()) },
8✔
49
        { "outputs", value_from(*instance.outputs_ptr()) },
8✔
50
        { "locktime", instance.locktime() }
51
    };
4✔
52
}
4✔
53

NEW
54
DEFINE_JSON_TO_TAG(transaction::cptr)
×
55
{
NEW
56
    return to_shared(tag_invoke(to_tag<transaction>{}, value));
×
57
}
58

59
DEFINE_JSON_FROM_TAG(transaction::cptr)
2✔
60
{
61
    tag_invoke(from_tag{}, value, *instance);
2✔
62
}
2✔
63

64
} // namespace chain
65
} // namespace system
66
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc