Skip to content

Commit 6c714ca

Browse files
committed
Use slot when upd_price message was received as publish slot for price
1 parent 9af84bf commit 6c714ca

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pc/request.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ void price::update_no_send(
722722
, const symbol_status st, const bool is_agg
723723
)
724724
{
725+
preq_->set_slot( get_manager()->get_slot() );
725726
preq_->set_price( price, conf, st, is_agg );
726727
}
727728

@@ -777,8 +778,6 @@ bool price::send( price *prices[], const unsigned n )
777778
.add( "price_type", price_type_to_str( p->get_price_type() ) ).end();
778779
continue;
779780
}
780-
const uint64_t slot = mgr->get_slot();
781-
p->preq_->set_slot( slot );
782781
p->preq_->set_block_hash( mgr->get_recent_block_hash() );
783782
upds_.emplace_back( p->preq_ );
784783

@@ -817,7 +816,7 @@ bool price::send( price *prices[], const unsigned n )
817816
.add( "symbol", p1->get_symbol() )
818817
.add( "price_type", price_type_to_str( p1->get_price_type() ) )
819818
.add( "sig", p1->tvec_.back().first )
820-
.add( "pub_slot", slot )
819+
.add( "pub_slot", p1->preq_->get_slot() )
821820
.end();
822821
if ( PC_UNLIKELY( p1->tvec_.size() >= 100 ) ) {
823822
PC_LOG_WRN( "too many unacked price update transactions" )

pc/rpc_client.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,10 @@ void rpc::upd_price::set_slot( const uint64_t pub_slot )
859859
pub_slot_ = pub_slot;
860860
}
861861

862+
uint64_t rpc::upd_price::get_slot() {
863+
return pub_slot_;
864+
}
865+
862866
signature *rpc::upd_price::get_signature()
863867
{
864868
return &sig_;

pc/rpc_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ namespace pc
414414
bool is_aggregate );
415415
void set_slot( uint64_t );
416416

417+
uint64_t get_slot();
418+
417419
// results
418420
signature *get_signature();
419421
str get_ack_signature() const;

0 commit comments

Comments
 (0)