MostroP2P / mostro

Lightning Network peer-to-peer exchange platform on Nostr
https://mostro.network
MIT License
154 stars 25 forks source link

Reject invalid ranges #320

Closed bilthon closed 5 days ago

bilthon commented 1 week ago

While testing ranges I was able to make mostro accept an order in which the min_amount > max_amount. The web client will prevent this from happening, but ideally these kinds of orders should also be rejected by mostrod in case other clients fail to catch this.

Here's a sample event that was accepted by mostro:

[
    "EVENT",
    "kinds:38383-since,au-377",
    {
        "tags":
        [
            [
                "d",
                "a5b58500-b9c7-4fbb-8fb7-a3aadeead498"
            ],
            [
                "k",
                "sell"
            ],
            [
                "f",
                "PEN"
            ],
            [
                "s",
                "pending"
            ],
            [
                "amt",
                "0"
            ],
            [
                "fa",
                "20",
                "12"
            ],
            [
                "pm",
                "Cash"
            ],
            [
                "premium",
                "0"
            ],
            [
                "rating",
                "{\"total_reviews\":2,\"total_rating\":4.0,\"last_rating\":5,\"max_rate\":5,\"min_rate\":1}"
            ],
            [
                "y",
                "mostrop2p"
            ],
            [
                "z",
                "order"
            ],
            [
                "expiration",
                "1720204380"
            ]
        ],
        "content": "",
        "sig": "d7654a114292b0b0a2c9f0e4a979d106e543726926358becc48912ed7ef5478c2af9b28c5738e1bd41dc7a591d78340ac545c63091fde8ffbd5ee5466763d52e",
        "id": "28580844bac22a84bcbe996ee900412d81087115916d12146bbd99eed290b345",
        "pubkey": "2ecbfef3fab5751c09bdc38d45f6bd0d633fa63f1bc252ec1c44c47db45e72d9",
        "created_at": 1720074781,
        "kind": 38383
    }
]
arkanoider commented 1 week ago

Will fix asap.

arkanoider commented 1 week ago

@bilthon give this a try...

https://github.com/MostroP2P/mostro/tree/fix-%23320

grunch commented 5 days ago

fixed via #322