Use the sideband when available in ledger.is_send (#2620)
This commit is contained in:
parent
7c6f436f6d
commit
5600dc6bbc
3 changed files with 17 additions and 4 deletions
|
|
@ -149,6 +149,11 @@ void nano::block::sideband_set (nano::block_sideband const & sideband_a)
|
||||||
sideband_m = sideband_a;
|
sideband_m = sideband_a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nano::block::has_sideband () const
|
||||||
|
{
|
||||||
|
return sideband_m.is_initialized ();
|
||||||
|
}
|
||||||
|
|
||||||
nano::account const & nano::block::representative () const
|
nano::account const & nano::block::representative () const
|
||||||
{
|
{
|
||||||
static nano::account rep{ 0 };
|
static nano::account rep{ 0 };
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ public:
|
||||||
nano::block_hash full_hash () const;
|
nano::block_hash full_hash () const;
|
||||||
nano::block_sideband const & sideband () const;
|
nano::block_sideband const & sideband () const;
|
||||||
void sideband_set (nano::block_sideband const &);
|
void sideband_set (nano::block_sideband const &);
|
||||||
|
bool has_sideband () const;
|
||||||
std::string to_json () const;
|
std::string to_json () const;
|
||||||
virtual void hash (blake2b_state &) const = 0;
|
virtual void hash (blake2b_state &) const = 0;
|
||||||
virtual uint64_t block_work () const = 0;
|
virtual uint64_t block_work () const = 0;
|
||||||
|
|
|
||||||
|
|
@ -807,6 +807,12 @@ std::string nano::ledger::block_text (nano::block_hash const & hash_a)
|
||||||
bool nano::ledger::is_send (nano::transaction const & transaction_a, nano::state_block const & block_a) const
|
bool nano::ledger::is_send (nano::transaction const & transaction_a, nano::state_block const & block_a) const
|
||||||
{
|
{
|
||||||
bool result (false);
|
bool result (false);
|
||||||
|
if (block_a.has_sideband ())
|
||||||
|
{
|
||||||
|
result = block_a.sideband ().details.is_send;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
nano::block_hash previous (block_a.hashables.previous);
|
nano::block_hash previous (block_a.hashables.previous);
|
||||||
if (!previous.is_zero ())
|
if (!previous.is_zero ())
|
||||||
{
|
{
|
||||||
|
|
@ -815,6 +821,7 @@ bool nano::ledger::is_send (nano::transaction const & transaction_a, nano::state
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue