allow optional casting of engine client to full client
This commit is contained in:
@@ -58,7 +58,13 @@ impl ValidatorContract {
|
||||
Box::new(move |a, d| client.as_ref()
|
||||
.and_then(Weak::upgrade)
|
||||
.ok_or("No client!".into())
|
||||
.and_then(|c| c.transact_contract(a, d).map_err(|e| format!("Transaction import error: {}", e)))
|
||||
.and_then(|c| {
|
||||
match c.as_full_client() {
|
||||
Some(c) => c.transact_contract(a, d)
|
||||
.map_err(|e| format!("Transaction import error: {}", e)),
|
||||
None => Err("No full client!".into()),
|
||||
}
|
||||
})
|
||||
.map(|_| Default::default()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,12 @@ impl ValidatorSet for ValidatorSafeContract {
|
||||
Box::new(move |addr, data| client.as_ref()
|
||||
.and_then(Weak::upgrade)
|
||||
.ok_or("No client!".into())
|
||||
.and_then(|c| c.call_contract(id, addr, data))
|
||||
.and_then(|c| {
|
||||
match c.as_full_client() {
|
||||
Some(c) => c.call_contract(id, addr, data),
|
||||
None => Err("No full client!".into()),
|
||||
}
|
||||
})
|
||||
.map(|out| (out, Vec::new()))) // generate no proofs in general
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user