+static bool
+transaction_has_spare_capacity(const fres_transaction_t* transaction)
+{
+ struct fres_contract **c;
+ forb_sequence_foreach(&transaction->contracts, c)
+ if (fres_contract_get_spare_capacity(*c))
+ return true;
+ return false;
+}
+
+static int
+transaction_get_resources(struct fcb *fcb, struct fcb_contract *fc[],
+ int num, struct resource **resources[])
+{
+ int i, j, r, alloc;
+ struct resource **res;
+ struct resource *resource;
+ struct res_key key;
+
+ alloc = 10;
+ res = malloc(alloc*sizeof(*res));
+ if (!res)
+ return errno;
+ res[0] = NULL;
+ for (r = 0, i = 0; i < num; i++) {
+ get_fc_res_key(fc[i], &key);
+ resource = fcb_resource_find(fcb, &key);
+ /* TODO: Check whether to use GSA for resources. */
+ }
+ res[r] = NULL;
+ return 0;
+}
+
+
+