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

libbitcoin / libbitcoin-system / 23096907349

14 Mar 2026 09:39PM UTC coverage: 81.295% (-0.02%) from 81.31%
23096907349

Pull #1794

github

web-flow
Merge d42b2b41f into 7440479d4
Pull Request #1794: 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

75.0
/src/chain/json/input.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/point.hpp>
23
#include <bitcoin/system/chain/script.hpp>
24
#include <bitcoin/system/chain/witness.hpp>
25
#include <bitcoin/system/define.hpp>
26

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

31
DEFINE_JSON_TO_TAG(input)
5✔
32
{
33
    return
5✔
34
    {
35
        value_to<point>(value.at("point")),
5✔
36
        value_to<script>(value.at("script")),
15✔
37
        value_to<witness>(value.at("witness")),
10✔
38
        value.at("sequence").to_number<uint32_t>()
10✔
39
    };
10✔
40
}
41

42
DEFINE_JSON_FROM_TAG(input)
10✔
43
{
44
    if (instance.witness().is_valid())
10✔
45
    {
46
        value =
40✔
47
        {
48
            { "point", value_from(instance.point()) },
20✔
49
            { "script", value_from(instance.script()) },
20✔
50
            { "witness", value_from(instance.witness()) },
20✔
51
            { "sequence", instance.sequence() }
52
        };
10✔
53
    }
54
    else
55
    {
NEW
56
        value =
×
57
        {
NEW
58
            { "point", value_from(instance.point()) },
×
NEW
59
            { "script", value_from(instance.script()) },
×
60
            { "sequence", instance.sequence() }
NEW
61
        };
×
62
    }
63
}
10✔
64

NEW
65
DEFINE_JSON_TO_TAG(input::cptr)
×
66
{
NEW
67
    return to_shared(tag_invoke(to_tag<input>{}, value));
×
68
}
69

70
DEFINE_JSON_FROM_TAG(input::cptr)
8✔
71
{
72
    tag_invoke(from_tag{}, value, *instance);
8✔
73
}
8✔
74

75
} // namespace chain
76
} // namespace system
77
} // 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