Skip to content

Commit

Permalink
FIX: try_push error handler, warp on
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuanyshbaev committed Feb 20, 2025
1 parent f3a4bed commit 6dbe02f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
17 changes: 10 additions & 7 deletions frame/rws/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ pub mod pallet {
NewSubscription(T::AccountId, Subscription),
/// Started new RWS subscription auction.
NewAuction(Subscription, T::AuctionIndex),
/// Can't start a new RWS subscription auction.
NewAuctionCreationError(T::AuctionIndex),
}

#[pallet::storage]
Expand Down Expand Up @@ -431,14 +433,15 @@ pub mod pallet {
let index = Self::auction_next();
<AuctionNext<T>>::mutate(|x| *x += 1u8.into());

// insert auction ledger
<Auction<T>>::insert(&index, AuctionLedger::new(kind.clone()));

// insert auction into queue
let _ = <AuctionQueue<T>>::mutate(|queue| queue.try_push(index.clone()));

// deposit descriptive event
Self::deposit_event(Event::NewAuction(kind, index));
if let Ok(_) = <AuctionQueue<T>>::mutate(|queue| queue.try_push(index.clone())) {
// insert auction ledger
<Auction<T>>::insert(&index, AuctionLedger::new(kind.clone()));
// deposit descriptive event
Self::deposit_event(Event::NewAuction(kind, index));
} else {
Self::deposit_event(Event::NewAuctionCreationError(index));
};
}

/// Rotate current auctions, register subscriptions and queue next.
Expand Down
10 changes: 5 additions & 5 deletions node/service/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ where
);
net_config.add_notification_protocol(grandpa_protocol_config);

// let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
// backend.clone(),
// grandpa_link.shared_authority_set().clone(),
// Vec::default(),
// ));
let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
Vec::default(),
));

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
Expand Down

0 comments on commit 6dbe02f

Please sign in to comment.