Skip to content

Commit

Permalink
Region pallet: fix request_region_record (#135)
Browse files Browse the repository at this point in the history
* Region pallet fixes

* fix

* cleanup & fixes

* emit request commitment

* fixes

* reduce timeout

* Region pallet: fix request_region_record
  • Loading branch information
Szegoo authored May 17, 2024
1 parent aae237c commit cfc93ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pallets/regions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ pub mod pallet {

ensure!(region.record.is_unavailable(), Error::<T>::NotUnavailable);

Self::do_request_region_record(region_id, who)?;
let commitment = Self::do_request_region_record(region_id, who.clone())?;
Regions::<T>::insert(
region_id,
Region { owner: who.clone(), record: Record::Pending(commitment) },
);

Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions pallets/regions/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ fn request_region_record_works() {
});

assert_ok!(Regions::request_region_record(RuntimeOrigin::signed(1), region_id));
assert!(region.record.is_pending());
let request = &requests()[0];
let Request::Get(get) = request.request.clone() else { panic!("Expected GET request") };

Expand Down

0 comments on commit cfc93ba

Please sign in to comment.