mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00
blackified
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
3d47043090
commit
1c1df2e335
@ -17,15 +17,12 @@ class ConditionDetails:
|
|||||||
|
|
||||||
def to_dict(self) -> dict:
|
def to_dict(self) -> dict:
|
||||||
if self.sub_conditions is None:
|
if self.sub_conditions is None:
|
||||||
return {
|
return {"type": self.type, "public_key": self.public_key}
|
||||||
"type": self.type,
|
|
||||||
"public_key": self.public_key
|
|
||||||
}
|
|
||||||
else:
|
else:
|
||||||
return {
|
return {
|
||||||
"type": self.type,
|
"type": self.type,
|
||||||
"threshold": self.threshold,
|
"threshold": self.threshold,
|
||||||
"subconditions": [sub_condition.to_dict() for sub_condition in self.sub_conditions]
|
"subconditions": [sub_condition.to_dict() for sub_condition in self.sub_conditions],
|
||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -121,8 +118,7 @@ def output_with_public_key(output, transaction_id) -> Output:
|
|||||||
public_keys=output["public_keys"],
|
public_keys=output["public_keys"],
|
||||||
amount=output["amount"],
|
amount=output["amount"],
|
||||||
condition=Condition(
|
condition=Condition(
|
||||||
uri=output["condition"]["uri"],
|
uri=output["condition"]["uri"], details=ConditionDetails.from_dict(output["condition"]["details"])
|
||||||
details=ConditionDetails.from_dict(output["condition"]["details"])
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -133,7 +129,6 @@ def output_with_sub_conditions(output, transaction_id) -> Output:
|
|||||||
public_keys=output["public_keys"],
|
public_keys=output["public_keys"],
|
||||||
amount=output["amount"],
|
amount=output["amount"],
|
||||||
condition=Condition(
|
condition=Condition(
|
||||||
uri=output["condition"]["uri"],
|
uri=output["condition"]["uri"], details=ConditionDetails.from_dict(output["condition"]["details"])
|
||||||
details=ConditionDetails.from_dict(output["condition"]["details"])
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -10,37 +10,29 @@ nested_threshold_output = {
|
|||||||
"condition": {
|
"condition": {
|
||||||
"details": {
|
"details": {
|
||||||
"subconditions": [
|
"subconditions": [
|
||||||
{
|
{"type": "ed25519-sha-256", "public_key": "7pT7eBEGJsmpUvRFhu7NUQSZVJVZDeF1xREuYKdVYUKK"},
|
||||||
"type": "ed25519-sha-256",
|
|
||||||
"public_key": "7pT7eBEGJsmpUvRFhu7NUQSZVJVZDeF1xREuYKdVYUKK"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"subconditions": [
|
"subconditions": [
|
||||||
{
|
{"type": "ed25519-sha-256", "public_key": "746ZbyMgoCJykAdzZ2vZcHzwnndrVnAAh6pv6yLZDiH2"},
|
||||||
"type": "ed25519-sha-256",
|
{"type": "ed25519-sha-256", "public_key": "EYb188vCQoaYDmW3Agen1u6Fh7xvDWCMnWJK8ueuCdbX"},
|
||||||
"public_key": "746ZbyMgoCJykAdzZ2vZcHzwnndrVnAAh6pv6yLZDiH2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ed25519-sha-256",
|
|
||||||
"public_key": "EYb188vCQoaYDmW3Agen1u6Fh7xvDWCMnWJK8ueuCdbX"
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"threshold": 2,
|
"threshold": 2,
|
||||||
"type": "threshold-sha-256"
|
"type": "threshold-sha-256",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"threshold": 1,
|
"threshold": 1,
|
||||||
"type": "threshold-sha-256"
|
"type": "threshold-sha-256",
|
||||||
},
|
},
|
||||||
"uri": "ni:///sha-256;hhw6Rf9JgwKYkapwE9qu7oVaI0ArS0hj_dmzAkpIPdc?fpt=threshold-sha-256&cost=266240&subtypes=ed25519-sha-256"
|
"uri": "ni:///sha-256;hhw6Rf9JgwKYkapwE9qu7oVaI0ArS0hj_dmzAkpIPdc?fpt=threshold-sha-256&cost=266240&subtypes=ed25519-sha-256",
|
||||||
},
|
},
|
||||||
"public_keys": [
|
"public_keys": [
|
||||||
"7pT7eBEGJsmpUvRFhu7NUQSZVJVZDeF1xREuYKdVYUKK",
|
"7pT7eBEGJsmpUvRFhu7NUQSZVJVZDeF1xREuYKdVYUKK",
|
||||||
"746ZbyMgoCJykAdzZ2vZcHzwnndrVnAAh6pv6yLZDiH2",
|
"746ZbyMgoCJykAdzZ2vZcHzwnndrVnAAh6pv6yLZDiH2",
|
||||||
"EYb188vCQoaYDmW3Agen1u6Fh7xvDWCMnWJK8ueuCdbX"
|
"EYb188vCQoaYDmW3Agen1u6Fh7xvDWCMnWJK8ueuCdbX",
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_output_nested_threshold_condition():
|
def test_output_nested_threshold_condition():
|
||||||
output = Output.outputs_dict(nested_threshold_output)
|
output = Output.outputs_dict(nested_threshold_output)
|
||||||
assert output
|
assert output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user