Skip to content

Commit d1a9f93

Browse files
atenjingguoss
authored andcommitted
fix bug for withdrawal revoke by trustee (paritytech#608)
1 parent 5b4d18c commit d1a9f93

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

cli/src/chainx_runtime.compact.wasm

248 Bytes
Binary file not shown.
Binary file not shown.

xrml/xassets/records/src/lib.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,23 @@ impl<T: Trait> Module<T> {
257257
}
258258

259259
if node.data.state != ApplicationState::Applying {
260-
error!("[withdrawal_finish]only allow `Processing` for this application|id:{:}|state:{:?}", serial_number, node.data.state);
260+
error!("[withdrawal_finish]|only allow `Applying` for this application|id:{:}|state:{:?}", serial_number, node.data.state);
261261
return Err("only allow `Applying` state for applicant revoke");
262262
}
263263
}
264264
Self::withdrawal_finish_impl(serial_number, ApplicationState::NormalCancel)
265265
}
266266

267+
pub fn withdrawal_revoke_by_trustee(serial_number: u32) -> Result {
268+
if let Some(node) = Self::application_map(serial_number) {
269+
if node.data.state != ApplicationState::Processing {
270+
error!("[withdrawal_revoke_by_trustee]|only allow `Processing` for this application|id:{:}|state:{:?}", serial_number, node.data.state);
271+
return Err("only allow `Processing` state for applicant revoke");
272+
}
273+
}
274+
Self::withdrawal_finish_impl(serial_number, ApplicationState::RootCancel)
275+
}
276+
267277
fn withdrawal_finish_impl(serial_number: u32, state: ApplicationState) -> Result {
268278
let mut node = if let Some(node) = Self::application_map(serial_number) {
269279
node

xrml/xbridge/bitcoin/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,12 @@ impl<T: Trait> Module<T> {
705705
"[apply_sig_withdraw]|{:}/{:} opposition, clear withdrawal propoal",
706706
reject_count, total
707707
);
708+
709+
// release withdrawal for applications
710+
for id in proposal.withdrawal_id_list.iter() {
711+
let _ = xrecords::Module::<T>::withdrawal_revoke_by_trustee(*id);
712+
}
713+
708714
CurrentWithdrawalProposal::<T>::kill();
709715

710716
// log event

0 commit comments

Comments
 (0)