Validate length of token_hash. Increase expiry times of routing status.

This commit is contained in:
Reckless_Satoshi 2022-05-30 07:08:32 -07:00
parent d1f671cf66
commit 5b214c3b9c
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 12 additions and 10 deletions

View File

@ -383,24 +383,24 @@ class Order(models.Model):
t_to_expire = {
0: int(config("EXP_MAKER_BOND_INVOICE")), # 'Waiting for maker bond'
1: self.public_duration, # 'Public'
1: self.public_duration, # 'Public'
2: 0, # 'Deleted'
3: int(config("EXP_TAKER_BOND_INVOICE")), # 'Waiting for taker bond'
4: 0, # 'Cancelled'
5: 0, # 'Expired'
6: self.escrow_duration, # 'Waiting for trade collateral and buyer invoice'
6: self.escrow_duration, # 'Waiting for trade collateral and buyer invoice'
7: 60 * int(config("INVOICE_AND_ESCROW_DURATION")), # 'Waiting only for seller trade collateral'
8: 60 * int(config("INVOICE_AND_ESCROW_DURATION")), # 'Waiting only for buyer invoice'
9: 60 * 60 * int(config("FIAT_EXCHANGE_DURATION")), # 'Sending fiat - In chatroom'
10: 60 * 60 * int(config("FIAT_EXCHANGE_DURATION")),# 'Fiat sent - In chatroom'
11: 1 * 24 * 60 * 60, # 'In dispute'
12: 0, # 'Collaboratively cancelled'
13: 24 * 60 * 60, # 'Sending satoshis to buyer'
14: 24 * 60 * 60, # 'Sucessful trade'
15: 24 * 60 * 60, # 'Failed lightning network routing'
13: 10 * 24 * 60 * 60, # 'Sending satoshis to buyer'
14: 10 * 24 * 60 * 60, # 'Sucessful trade'
15: 10 * 24 * 60 * 60, # 'Failed lightning network routing'
16: 10 * 24 * 60 * 60, # 'Wait for dispute resolution'
17: 24 * 60 * 60, # 'Maker lost dispute'
18: 24 * 60 * 60, # 'Taker lost dispute'
17: 10 * 24 * 60 * 60, # 'Maker lost dispute'
18: 10 * 24 * 60 * 60, # 'Taker lost dispute'
}
return t_to_expire[status]

View File

@ -82,17 +82,19 @@ class UpdateOrderSerializer(serializers.Serializer):
class UserGenSerializer(serializers.Serializer):
# Mandatory fields
token_sha256 = serializers.CharField(max_length=64,
token_sha256 = serializers.CharField(
min_length=64,
max_length=64,
allow_null=False,
allow_blank=False,
required=True,
help_text="SHA256 of user secret")
public_key = serializers.CharField(max_length=999,
public_key = serializers.CharField(max_length=2000,
allow_null=False,
allow_blank=False,
required=True,
help_text="Armored ASCII PGP public key block")
encrypted_private_key = serializers.CharField(max_length=999,
encrypted_private_key = serializers.CharField(max_length=2000,
allow_null=False,
allow_blank=False,
required=True,