|
16 | 16 | {
|
17 | 17 | pub inner: crate::wallet::p::P<T>,
|
18 | 18 |
|
| 19 | + /// In order to add a validator to this Subnet, threshold signatures are required from the addresses in controlKeys |
| 20 | + pub control_keys: Vec<ids::short::Id>, |
| 21 | + pub threshold: u32, |
| 22 | + |
19 | 23 | /// Set "true" to poll transaction status after issuance for its acceptance.
|
20 | 24 | pub check_acceptance: bool,
|
21 | 25 |
|
|
37 | 41 | pub fn new(p: &crate::wallet::p::P<T>) -> Self {
|
38 | 42 | Self {
|
39 | 43 | inner: p.clone(),
|
| 44 | + control_keys: vec![p.inner.short_address.clone()], |
| 45 | + threshold: 1, |
40 | 46 | check_acceptance: false,
|
41 | 47 | poll_initial_wait: Duration::from_millis(1500),
|
42 | 48 | poll_interval: Duration::from_secs(1),
|
|
45 | 51 | }
|
46 | 52 | }
|
47 | 53 |
|
| 54 | + /// Sets the control keys. |
| 55 | + #[must_use] |
| 56 | + pub fn control_keys(mut self, control_keys: Vec<ids::short::Id>) -> Self { |
| 57 | + self.control_keys = control_keys; |
| 58 | + self |
| 59 | + } |
| 60 | + |
| 61 | + /// Sets the threshold. |
| 62 | + #[must_use] |
| 63 | + pub fn threshold(mut self, threshold: u32) -> Self { |
| 64 | + self.threshold = threshold; |
| 65 | + self |
| 66 | + } |
| 67 | + |
48 | 68 | /// Sets the check acceptance boolean flag.
|
49 | 69 | #[must_use]
|
50 | 70 | pub fn check_acceptance(mut self, check_acceptance: bool) -> Self {
|
@@ -100,8 +120,8 @@ where
|
100 | 120 | },
|
101 | 121 | owner: key::secp256k1::txs::OutputOwners {
|
102 | 122 | locktime: 0,
|
103 |
| - threshold: 1, |
104 |
| - addresses: vec![self.inner.inner.short_address.clone()], |
| 123 | + threshold: self.threshold, |
| 124 | + addresses: self.control_keys.clone(), |
105 | 125 | },
|
106 | 126 | ..Default::default()
|
107 | 127 | };
|
|
0 commit comments