-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support for opening/closing private broker channels #5361
base: main
Are you sure you want to change the base?
Conversation
0ec1476
to
962a41e
Compare
74795ff
to
e5afd8d
Compare
@@ -582,6 +582,10 @@ pub mod pallet { | |||
pub(crate) type ScheduledTxForReject<T: Config<I>, I: 'static = ()> = | |||
StorageValue<_, Vec<TaintedTransactionDetails<T, I>>, ValueQuery>; | |||
|
|||
#[pallet::storage] | |||
pub(crate) type BrokerPrivateChannels<T: Config<I>, I: 'static = ()> = | |||
StorageMap<_, Twox64Concat, T::AccountId, ChannelId, OptionQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use the Identity hasher.
StorageMap<_, Twox64Concat, T::AccountId, ChannelId, OptionQuery>; | |
StorageMap<_, Identity, T::AccountId, ChannelId, OptionQuery>; |
d59a952
to
d407b8c
Compare
1f00ed3
to
cdeb52c
Compare
cdeb52c
to
4e3828c
Compare
let next_channel_id = | ||
ChannelIdCounter::<T, I>::try_mutate::<_, Error<T, I>, _>(|id| { | ||
*id = id.checked_add(1).ok_or(Error::<T, I>::ChannelIdsExhausted)?; | ||
Ok(*id) | ||
})?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make this a function, is duplicate
let broker_id = T::AccountRoleRegistry::ensure_broker(origin)?; | ||
|
||
ensure!( | ||
!BrokerPrivateChannels::<T, I>::contains_key(&broker_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also restrict this to be just for Bitcoin - it's not useful for any other chains right? probably more importantly is that not restricting it to Bitcoin would be confusing when reading the code, since it's an instantiable pallet, we'd assume it's for all instances.
I feel like we can just add this here. We need it and it's not a lot of work to add. Not sure what we gain by waiting. (Sorry was sure I left this comment yesterday...) |
Forgot to mention - I think charging/not charging a fee needs a little more discussion, happy to leave this out for now. |
Pull Request
Closes: PRO-1748
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
AccountId
->ChannelId
Out of scope (these seem like may need some further discussion):
(will create separate linear tickets for these if we agree to leave them out of this PR)
May need to rebase this after #5357 is merged.